diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index cd6332ff..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/gtest"] - path = lib/gtest - url = https://github.com/google/googletest.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d4e41e6..16657076 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,6 @@ endif() # used by e.g., Debian packaging infrastructure include(GNUInstallDirs) -add_subdirectory(lib) add_subdirectory(src) if(BUILD_TESTING) diff --git a/ci/install-deps.sh b/ci/install-deps.sh index 84bce412..ca530997 100755 --- a/ci/install-deps.sh +++ b/ci/install-deps.sh @@ -34,6 +34,7 @@ packages=( lcov gcovr libboost-dev + libgtest-dev ) # make sure installation won't hang on GitHub actions diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index a3540706..7cce2db0 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -1,5 +1,6 @@ # >= 3.2 required for ExternalProject_Add_StepDependencies -cmake_minimum_required(VERSION 3.2) +# >= 3.20 for FindGTest IMPORTED target +cmake_minimum_required(VERSION 3.20) include(${CMAKE_CURRENT_LIST_DIR}/scripts.cmake) @@ -33,6 +34,10 @@ set(CFLAGS ${DEPENDENCIES_CFLAGS}) set(CPPFLAGS ${DEPENDENCIES_CPPFLAGS}) set(LDFLAGS ${DEPENDENCIES_LDFLAGS}) +if(BUILD_TESTING) + find_package(GTest REQUIRED) +endif() + if (NOT LIBAPPIMAGE_SHARED_ONLY) import_pkgconfig_target(TARGET_NAME liblzma PKGCONFIG_TARGET liblzma) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index 4daa6633..00000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -include(CTest) - -if(BUILD_TESTING) - if(NOT TARGET gtest) - if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gtest) - add_subdirectory(gtest EXCLUDE_FROM_ALL) - else() - message(FATAL_ERROR "gtest submodule not found; please call git submodule update --init or disable the unit tests using -DBUILD_TESTING=OFF") - endif() - endif() -endif() diff --git a/lib/gtest b/lib/gtest deleted file mode 160000 index ec44c6c1..00000000 --- a/lib/gtest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ec44c6c1675c25b9827aacd08c02433cccde7780 diff --git a/tests/libappimage/CMakeLists.txt b/tests/libappimage/CMakeLists.txt index cd985637..76a5e254 100644 --- a/tests/libappimage/CMakeLists.txt +++ b/tests/libappimage/CMakeLists.txt @@ -25,7 +25,7 @@ if (NOT LIBAPPIMAGE_SHARED_ONLY) ) target_include_directories(test_libappimage++ PRIVATE "${PROJECT_SOURCE_DIR}/src/libappimage") - target_link_libraries(test_libappimage++ temporarydirectory libappimage libarchive libsquashfuse XdgUtils::DesktopEntry XdgUtils::BaseDir gtest gtest_main) + target_link_libraries(test_libappimage++ temporarydirectory libappimage libarchive libsquashfuse XdgUtils::DesktopEntry XdgUtils::BaseDir GTest::gtest GTest::gtest_main) add_test(test_libappimage++ test_libappimage++) endif() diff --git a/tests/libappimage/desktop_integration/CMakeLists.txt b/tests/libappimage/desktop_integration/CMakeLists.txt index c6986ada..6268b661 100644 --- a/tests/libappimage/desktop_integration/CMakeLists.txt +++ b/tests/libappimage/desktop_integration/CMakeLists.txt @@ -36,8 +36,8 @@ target_link_libraries(TestDesktopIntegration # statically once glib is loaded. PRIVATE libglib PUBLIC dl - PRIVATE gtest - PRIVATE gtest_main + PRIVATE GTest::gtest + PRIVATE GTest::gtest_main PRIVATE librsvg PRIVATE libcairo ) diff --git a/tests/libappimage/legacy/CMakeLists.txt b/tests/libappimage/legacy/CMakeLists.txt index 874d92de..f2a57a53 100644 --- a/tests/libappimage/legacy/CMakeLists.txt +++ b/tests/libappimage/legacy/CMakeLists.txt @@ -4,7 +4,7 @@ set_property(TARGET fixtures PROPERTY INTERFACE_LINK_LIBRARIES xdg-basedir gtest if (NOT LIBAPPIMAGE_SHARED_ONLY) add_executable(test_libappimage test_libappimage.cpp) - target_link_libraries(test_libappimage fixtures libappimage libsquashfuse libglib libgobject gtest gtest_main) + target_link_libraries(test_libappimage fixtures libappimage libsquashfuse libglib libgobject GTest::gtest GTest::gtest_main) add_executable(test-xdg-basedir test-xdg-basedir.cpp) target_link_libraries(test-xdg-basedir fixtures xdg-basedir)