fix: set gtest_force_shared_crt in tests (#4033)

This commit is contained in:
nerix 2022-10-01 20:46:59 +02:00 committed by GitHub
parent ba586f01d0
commit 2deed8e1cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,12 +104,16 @@ find_package(RapidJSON REQUIRED)
find_package(Websocketpp REQUIRED) find_package(Websocketpp REQUIRED)
if (BUILD_TESTS) if (BUILD_TESTS)
# For MSVC: Prevent overriding the parent project's compiler/linker settings
# See https://github.com/google/googletest/blob/main/googletest/README.md#visual-studio-dynamic-vs-static-runtimes
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/lib/googletest" "lib/googletest") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/lib/googletest" "lib/googletest")
mark_as_advanced( mark_as_advanced(
BUILD_GMOCK BUILD_GTEST BUILD_SHARED_LIBS BUILD_GMOCK BUILD_GTEST BUILD_SHARED_LIBS
gmock_build_tests gtest_build_samples gtest_build_tests gmock_build_tests gtest_build_samples gtest_build_tests
gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols
) )
set_target_properties(gtest PROPERTIES FOLDER lib) set_target_properties(gtest PROPERTIES FOLDER lib)