diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 89176633..9d0216c8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -109,7 +109,18 @@ add_fmt_test(custom-formatter-test) add_fmt_test(ranges-test) add_fmt_test(scan-test) -if (NOT MSVC_BUILD_STATIC) +if (NOT DEFINED MSVC_STATIC_RUNTIME AND MSVC) + foreach (flag_var + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if (${flag_var} MATCHES "^(/|-)(MT|MTd)") + set(MSVC_STATIC_RUNTIME ON) + break() + endif() + endforeach() +endif() + +if (NOT MSVC_STATIC_RUNTIME) add_fmt_executable(posix-mock-test posix-mock-test.cc ../src/format.cc ${TEST_MAIN_SRC}) target_include_directories(