From 9b31ff1ec030e88c4e2965dd912848a26352c578 Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Tue, 11 Jun 2024 15:43:04 +0200 Subject: [PATCH] Use gtest vcpkg module --- .gitmodules | 3 --- CMakeLists.txt | 1 - Core/Core_UnitTests/CMakeLists.txt | 4 +++- Core/IoCore_UnitTests/CMakeLists.txt | 3 ++- Core/ProjectDataModel_UnitTests/CMakeLists.txt | 3 ++- RestInterface/RestInterface_UnitTests/CMakeLists.txt | 3 ++- ThirdParty/gtest | 1 - 7 files changed, 9 insertions(+), 9 deletions(-) delete mode 160000 ThirdParty/gtest diff --git a/.gitmodules b/.gitmodules index 72d2db41..5008c7f6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -11,9 +11,6 @@ path = Bindings/Python/caffa url = https://github.com/lindkvis/caffa-python.git -[submodule "ThirdParty/gtest"] - path = ThirdParty/gtest - url = https://github.com/google/googletest.git [submodule "ThirdParty/vcpkg"] path = ThirdParty/vcpkg url = https://github.com/microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 20632de8..9d8a55e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ set(UUID_BUILD_TESTS OFF CACHE INTERNAL "Build stduuid tests") -add_subdirectory(ThirdParty/gtest) add_subdirectory(ThirdParty/stduuid) add_subdirectory(ThirdParty/caffa-base) diff --git a/Core/Core_UnitTests/CMakeLists.txt b/Core/Core_UnitTests/CMakeLists.txt index fc4aec4e..58180b58 100644 --- a/Core/Core_UnitTests/CMakeLists.txt +++ b/Core/Core_UnitTests/CMakeLists.txt @@ -21,6 +21,8 @@ add_executable(${PROJECT_NAME} ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES}) -target_link_libraries(${PROJECT_NAME} gtest caffaCore ${THREAD_LIBRARY}) +find_package(GTest CONFIG REQUIRED) + +target_link_libraries(${PROJECT_NAME} GTest::gtest caffaCore ${THREAD_LIBRARY}) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/Core/IoCore_UnitTests/CMakeLists.txt b/Core/IoCore_UnitTests/CMakeLists.txt index 0ee0cd67..40852dd3 100644 --- a/Core/IoCore_UnitTests/CMakeLists.txt +++ b/Core/IoCore_UnitTests/CMakeLists.txt @@ -6,8 +6,9 @@ project(caffaIoCore_UnitTests) add_executable(${PROJECT_NAME} cafIo_UnitTests.cpp cafIoBasicTest.cpp cafAdvancedTemplateTest.cpp cafIoNumberTest.cpp cafReadmeObjects.cpp) find_package(nlohmann_json CONFIG REQUIRED) +find_package(GTest CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} caffaCore ${THREAD_LIBRARY} nlohmann_json::nlohmann_json gtest) +target_link_libraries(${PROJECT_NAME} caffaCore ${THREAD_LIBRARY} nlohmann_json::nlohmann_json GTest::gtest) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Core/ProjectDataModel_UnitTests/CMakeLists.txt b/Core/ProjectDataModel_UnitTests/CMakeLists.txt index fc2e57b6..71b3f61c 100644 --- a/Core/ProjectDataModel_UnitTests/CMakeLists.txt +++ b/Core/ProjectDataModel_UnitTests/CMakeLists.txt @@ -10,8 +10,9 @@ set(PROJECT_FILES cafBasicTest.cpp cafProjectDataModel_UnitTests.cpp Child.cpp P add_executable(${PROJECT_NAME} ${PROJECT_FILES}) find_package(nlohmann_json CONFIG REQUIRED) +find_package(GTest CONFIG REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE caffaCore gtest ${THREAD_LIBRARY} nlohmann_json::nlohmann_json) +target_link_libraries(${PROJECT_NAME} PRIVATE caffaCore GTest::gtest ${THREAD_LIBRARY} nlohmann_json::nlohmann_json) source_group("" FILES ${PROJECT_FILES}) diff --git a/RestInterface/RestInterface_UnitTests/CMakeLists.txt b/RestInterface/RestInterface_UnitTests/CMakeLists.txt index d5ef07d5..64c164d8 100644 --- a/RestInterface/RestInterface_UnitTests/CMakeLists.txt +++ b/RestInterface/RestInterface_UnitTests/CMakeLists.txt @@ -9,12 +9,13 @@ add_executable(${PROJECT_NAME} ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES}) find_package(Boost 1.71.0 REQUIRED COMPONENTS program_options) +find_package(GTest CONFIG REQUIRED) target_link_libraries( ${PROJECT_NAME} Boost::program_options ${THREAD_LIBRARY} - gtest + GTest::gtest caffaCore caffaRestInterface caffaTestData) diff --git a/ThirdParty/gtest b/ThirdParty/gtest deleted file mode 160000 index f8d7d77c..00000000 --- a/ThirdParty/gtest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f8d7d77c06936315286eb55f8de22cd23c188571