Commit cac5a6d5 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

CMake: fetch gtest

parent d9f6c811
Pipeline #18206 failed with stage
in 4 minutes and 40 seconds
......@@ -10,10 +10,23 @@ if (NOT TARGET OpenVolumeMesh::OpenVolumeMesh)
find_package(OpenVolumeMesh REQUIRED)
endif()
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
)
if(WIN32)
# avoid linking errors, cf https://stackoverflow.com/questions/12540970/how-to-make-gtest-build-mdd-instead-of-mtd-by-default-using-cmake
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()
FetchContent_MakeAvailable(googletest)
set(TARGET_NAME "${OVM_TARGET_PREFIX}unittests")
enable_testing()
find_package(GTest)
if(GTEST_FOUND)
include(GoogleTest)
......@@ -21,8 +34,7 @@ if(GTEST_FOUND)
add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(${TARGET_NAME}
OpenVolumeMesh::OpenVolumeMesh
GTest::GTest
GTest::Main
gtest gtest_main
)
gtest_add_tests(TARGET ${TARGET_NAME}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment