diff --git a/CMakeLists.txt b/CMakeLists.txt index c7121046d..05d78ebb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -800,10 +800,11 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST) if(MSVC) foreach(target gtest gmock) + set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded$<${DBG}:Debug>) # `/w` disables all warnings. This is needed because `gtest` enables # `/WX` (equivalent of `-Werror`) for some reason, breaking builds # when MSVS adds new warnings. - target_compile_options(${target} PRIVATE $<$:/MT> $<${DBG}:/MTd> /w) + target_compile_options(${target} PRIVATE /w) endforeach() endif() @@ -2996,7 +2997,7 @@ set(TARGETS ${TARGETS_OWN} ${TARGETS_DEP}) foreach(target ${TARGETS}) if(MSVC) - target_compile_options(${target} PRIVATE $<$:/MT> $<${DBG}:/MTd>) # Use static CRT + set_property(TARGET ${target} PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded$<${DBG}:Debug>) # Use static CRT target_compile_options(${target} PRIVATE /MP) # Use multiple cores target_compile_options(${target} PRIVATE /EHsc) # Only catch C++ exceptions with catch. target_compile_options(${target} PRIVATE /GS) # Protect the stack pointer.