Skip to content

Commit

Permalink
Install gtest from distro
Browse files Browse the repository at this point in the history
Allows us to remove the custom install scripts from CMake.
  • Loading branch information
TheAssassin committed Dec 2, 2024
1 parent a0967b2 commit 7b83b72
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 23 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ endif()
# used by e.g., Debian packaging infrastructure
include(GNUInstallDirs)

add_subdirectory(lib)
add_subdirectory(src)

if(BUILD_TESTING)
Expand Down
1 change: 1 addition & 0 deletions ci/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ packages=(
lcov
gcovr
libboost-dev
libgtest-dev
)

# make sure installation won't hang on GitHub actions
Expand Down
7 changes: 6 additions & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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)

Expand Down
13 changes: 0 additions & 13 deletions lib/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/gtest
Submodule gtest deleted from ec44c6
2 changes: 1 addition & 1 deletion tests/libappimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 2 additions & 2 deletions tests/libappimage/desktop_integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion tests/libappimage/legacy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7b83b72

Please sign in to comment.