diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7ddf4a9452..b123414bc8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,37 @@ # 'Google_test' is the subproject name project(Google_tests) +if(WIN32) + add_definitions(-DCOIN_DLL) +endif(WIN32) + +if(MSVC) + option( + gtest_force_shared_crt + "Use shared (DLL) run-time lib even when Google Test is built as static lib." + ON) + + set(Google_Tests_LIBS + oldnames.lib + debug msvcrtd.lib + debug msvcprtd.lib + optimized msvcrt.lib + optimized msvcprt.lib + ) + + #Universal C runtime introduced in VS 2015 (cl version 19) + if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19")) + list(APPEND Google_Tests_LIBS + debug vcruntimed.lib + debug ucrtd.lib + debug concrtd.lib + optimized vcruntime.lib + optimized ucrt.lib + optimized concrt.lib + ) + endif() +endif() + # 'lib' is the folder with Google Test sources add_subdirectory(lib) include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) @@ -14,7 +45,7 @@ add_executable( src/test2.cpp ) -target_link_libraries(Google_Tests_run gtest gtest_main) +target_link_libraries(Google_Tests_run gtest gtest_main ${Google_Tests_LIBS}) # ------------------------------------------------------