Skip to content

Commit

Permalink
fix: set /Zc:__cplusplus and /MP to MSVC only (#3139)
Browse files Browse the repository at this point in the history
1. macro `__cplusplus` is enabled by clang-cl
2. `/MP` is not supported by clang-cl (warning `-Wunused-command-line-argument` will be generated)
  • Loading branch information
zjyhjqs authored Jul 22, 2024
1 parent 885b547 commit 5ebfc92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ elseif(NOT CMAKE_CXX_STANDARD)
endif()

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

Expand Down Expand Up @@ -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")
target_compile_options(spdlog PUBLIC $<$<AND:$<CXX_COMPILER_ID:MSVC>,$<NOT:$<COMPILE_LANGUAGE:CUDA>>>:/wd4251
/wd4275>)
endif()
Expand Down

0 comments on commit 5ebfc92

Please sign in to comment.