Skip to content

Commit

Permalink
Better GoogleTest handling in case of MSVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
breyerml committed Feb 17, 2025
1 parent 3aa2081 commit 20b1c8c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLSSVM_STL_DEBUG_MODE_FLAGS}")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
# TODO: really use custom fork? -> try finding another GoogleTest fix for MSVC on Windows
if (MSVC)
# use custom fork including linker bugfix
message(STATUS "Use custom GoogleTest fork fixing a MSVC linker problem.")
set(PLSSVM_googletest_REPO https://github.com/breyerml/googletest)
set(PLSSVM_googletest_VERSION windows-msvc-fix)
else ()
# use original repo otherwise
message(STATUS "Use GoogleTest upstream repository.")
set(PLSSVM_googletest_REPO https://github.com/google/googletest)
endif ()
# fetch testing framework GoogleTest
include(FetchContent)
# TODO: really use custom fork? -> try finding another GoogleTest fix for MSVC on Windows
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/breyerml/googletest
GIT_TAG windows-msvc-fix
GIT_REPOSITORY ${PLSSVM_googletest_REPO}
GIT_TAG ${PLSSVM_googletest_VERSION}
GIT_SHALLOW TRUE
QUIET
)
Expand Down

0 comments on commit 20b1c8c

Please sign in to comment.