-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: set /Zc:__cplusplus
and /MP
to MSVC only
#3139
Conversation
1. macro `__cplusplus` is enabled by clang-cl 2. `/MP` is not supported by clang-cl (warning `-Wunused-command-line-argument` will be generated)
I dont get it. MSVC is defined by cmake when using msvc compiler (https://cmake.org/cmake/help/latest/variable/MSVC.html) |
MSVC is also defined when clang-cl is used. |
@@ -161,7 +161,7 @@ if(SPDLOG_BUILD_SHARED OR BUILD_SHARED_LIBS) | |||
endif() | |||
add_library(spdlog SHARED ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS}) | |||
target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB) | |||
if(MSVC) | |||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
statement is not necessary because $<CXX_COMPILER_ID:MSVC>
appears in the following cmake-generator-expressions.
target_compile_options(spdlog PUBLIC $<$<AND:$<CXX_COMPILER_ID:MSVC>,$<NOT:$<COMPILE_LANGUAGE:CUDA>>>:/wd4251
/wd4275>)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appears in the following cmake-generator-expressions.
but it is reached only if build shared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is reached only if build shared.
I overlooked it. In that sense, we need to set the same option for spdlog::spdlog_header_only
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps, but it is not directly related to this pr, so i will approve for now
Merged. Thanks @zjyhjqs |
__cplusplus
is enabled by clang-cl/MP
is not supported by clang-cl (warning-Wunused-command-line-argument
will be generated)see also: https://clang.llvm.org/docs/UsersManual.html#id11