Skip to content

Commit 5ebfc92

Browse files
authored
fix: set /Zc:__cplusplus and /MP to MSVC only (#3139)
1. macro `__cplusplus` is enabled by clang-cl 2. `/MP` is not supported by clang-cl (warning `-Wunused-command-line-argument` will be generated)
1 parent 885b547 commit 5ebfc92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ elseif(NOT CMAKE_CXX_STANDARD)
3434
endif()
3535

3636
# make sure __cplusplus is defined when using msvc and enable parallel build
37-
if(MSVC)
37+
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
3838
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus /MP")
3939
endif()
4040

@@ -161,7 +161,7 @@ if(SPDLOG_BUILD_SHARED OR BUILD_SHARED_LIBS)
161161
endif()
162162
add_library(spdlog SHARED ${SPDLOG_SRCS} ${SPDLOG_ALL_HEADERS})
163163
target_compile_definitions(spdlog PUBLIC SPDLOG_SHARED_LIB)
164-
if(MSVC)
164+
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
165165
target_compile_options(spdlog PUBLIC $<$<AND:$<CXX_COMPILER_ID:MSVC>,$<NOT:$<COMPILE_LANGUAGE:CUDA>>>:/wd4251
166166
/wd4275>)
167167
endif()

0 commit comments

Comments
 (0)