diff options
| author | Léo Lam <leo@leolam.fr> | 2021-04-24 23:12:30 +0200 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2021-04-27 12:54:18 +0200 |
| commit | dcf3ca0f8995324471fc3359ee17d7ea89afd8fc (patch) | |
| tree | 3f8b4e4d947098e0395b7942d341214eda7392fd | |
| parent | 51bf2dca210e198c50600851cbe1538037873914 (diff) | |
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:
https://github.com/google/googletest/blob/23ef29555ef4789f555f1ba8c51b4c52975f0907/googletest/README.md#visual-studio-dynamic-vs-static-runtimes
| -rw-r--r-- | CMakeLists.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 06137c57e0..727d32ccef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -844,6 +844,8 @@ include_directories("${PROJECT_BINARY_DIR}/Source/Core") # if(ENABLE_TESTS) 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) else() message(STATUS "Unit tests are disabled") |
