From d2f14a261bcd98e8b735de299b7f41e57af08ad2 Mon Sep 17 00:00:00 2001 From: Nick Logozzo Date: Tue, 5 Dec 2023 22:36:55 -0500 Subject: [PATCH] Fix Test Building --- .github/workflows/build.yml | 2 +- CMakeLists.txt | 18 ++++++++++++++++-- tests/CMakeLists.txt | 17 ----------------- 3 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 tests/CMakeLists.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8de20d..d1a63b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,7 @@ jobs: working-directory: ${{github.workspace}}/build run: cmake --install . --prefix "${{github.workspace}}/install" - name: "CMake Test" - working-directory: ${{github.workspace}}/build/tests + working-directory: ${{github.workspace}}/build run: ctest - name: Upload uses: actions/upload-artifact@v1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 923d5c6..e5837f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ if(LINUX) pkg_check_modules(gthread-2.0 REQUIRED IMPORTED_TARGET gthread-2.0) pkg_search_module(UUID REQUIRED uuid) target_include_directories(${PROJECT_NAME} PUBLIC ${UUID_INCLUDE_DIRS}) - target_link_libraries(${PROJECT_NAME} PUBLIC libsecret::libsecret PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0 ${UUID_LIBRARIES} -lresolv) + target_link_libraries(${PROJECT_NAME} PUBLIC resolv libsecret::libsecret PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0 ${UUID_LIBRARIES}) endif() #libaura Install @@ -72,4 +72,18 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INC install(FILES ${CMAKE_BINARY_DIR}/libaura.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) #libaura Tests -add_subdirectory(tests) \ No newline at end of file +enable_testing() + +add_executable(${PROJECT_NAME}_test + tests/eventtests.cpp + tests/main.cpp + tests/networktests.cpp + tests/stringtests.cpp + tests/versiontests.cpp + tests/webtests.cpp) + +find_package(GTest REQUIRED) +target_link_libraries(${PROJECT_NAME}_test PRIVATE libaura GTest::gtest_main GTest::gmock_main) + +include(GoogleTest) +gtest_discover_tests(${PROJECT_NAME}_test) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 25f4bfe..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -project("libaura_test") - -enable_testing() - -add_executable(${PROJECT_NAME} - eventtests.cpp - main.cpp - networktests.cpp - stringtests.cpp - versiontests.cpp - webtests.cpp) - -find_package(GTest REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE libaura GTest::gtest_main GTest::gmock_main) - -include(GoogleTest) -gtest_discover_tests(${PROJECT_NAME}) \ No newline at end of file