Skip to content

Commit 2f7118b

Browse files
committed
Try fixing MSVC error.
1 parent 346d370 commit 2f7118b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
list(APPEND CMAKE_MESSAGE_INDENT "Tests: ")
88

99
# setup testing wit GoogleTest
10-
set(PLSSVM_googletest_VERSION v1.14.0)
11-
find_package(GTest 1.14.0 QUIET)
10+
set(PLSSVM_googletest_VERSION v1.15.2)
11+
find_package(GTest 1.15.2 QUIET)
1212
if (GTEST_FOUND)
1313
message(STATUS "Found package GTest.")
1414
else ()
@@ -34,6 +34,12 @@ else ()
3434
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
3535
FetchContent_MakeAvailable(googletest)
3636
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_OLD}")
37+
38+
# try fixing MSVC Windows problem
39+
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
40+
message(STATUS "Change GTEST_API_ in the gtest_main.cc file.")
41+
set_source_files_properties("${googletest_SOURCE_DIR}/src/gtest_main.cc" PROPERTIES COMPILE_DEFINITIONS GTEST_API_="")
42+
endif ()
3743
endif ()
3844

3945
# create larger test files if desired

0 commit comments

Comments
 (0)