Skip to content

Commit

Permalink
Autodetect MSVC static runtime (fmtlib#1770)
Browse files Browse the repository at this point in the history
* Autodetect MSVC static runtime

* Update condition (MSVC)
  • Loading branch information
dvetutnev authored Jul 13, 2020
1 parent c108ee1 commit a03bd3d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a03bd3d

Please sign in to comment.