CMake: Force gtest to link CRT dynamically to avoid runtime mismatches
Required to fix unit test builds for Windows+MSVC+CMake.
For more information, see:
23ef29555e/googletest/README.md (visual-studio-dynamic-vs-static-runtimes)
This commit is contained in:
parent
51bf2dca21
commit
dcf3ca0f89
|
@ -844,6 +844,8 @@ include_directories("${PROJECT_BINARY_DIR}/Source/Core")
|
||||||
#
|
#
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
message(STATUS "Using static gtest from Externals")
|
message(STATUS "Using static gtest from Externals")
|
||||||
|
# Force gtest to link the C runtime dynamically on Windows in order to avoid runtime mismatches.
|
||||||
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
|
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
|
||||||
else()
|
else()
|
||||||
message(STATUS "Unit tests are disabled")
|
message(STATUS "Unit tests are disabled")
|
||||||
|
|
Loading…
Reference in New Issue