Skip to content

Commit

Permalink
CMake - BUILD_TESTING Flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Dec 8, 2023
1 parent 8aebdd6 commit fbb90b1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: "CMake Build"
working-directory: ${{github.workspace}}/build
run: |
cmake .. -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/build/Release/generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake .. -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/build/Release/generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=ON
cmake --build .
- name: "CMake Install"
working-directory: ${{github.workspace}}/build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: "CMake Build"
working-directory: ${{github.workspace}}/build
run: |
cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/build/generators/conan_toolchain.cmake"
cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="${{github.workspace}}/build/generators/conan_toolchain.cmake" -DBUILD_TESTING=ON
cmake --build . --config ${{env.BUILD_TYPE}}
- name: "CMake Install"
working-directory: ${{github.workspace}}/build
Expand Down
35 changes: 20 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,25 @@ install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PR
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
install(FILES ${CMAKE_BINARY_DIR}/libaura.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)

#libaura Tests
enable_testing()
#libaura_test
if(BUILD_TESTING)
{
#libaura_test Setup
enable_testing()
add_executable(${PROJECT_NAME}_test
tests/eventtests.cpp
tests/main.cpp
tests/networktests.cpp
tests/stringtests.cpp
tests/updatertests.cpp
tests/versiontests.cpp
tests/webtests.cpp)

add_executable(${PROJECT_NAME}_test
tests/eventtests.cpp
tests/main.cpp
tests/networktests.cpp
tests/stringtests.cpp
tests/updatertests.cpp
tests/versiontests.cpp
tests/webtests.cpp)
#libaura_test Packages
find_package(GTest REQUIRED)
target_link_libraries(${PROJECT_NAME}_test PUBLIC libaura GTest::gtest_main GTest::gmock_main)

find_package(GTest REQUIRED)
target_link_libraries(${PROJECT_NAME}_test PUBLIC libaura GTest::gtest_main GTest::gmock_main)

include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_test)
#libaura_test Tests
include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME}_test)
}

0 comments on commit fbb90b1

Please sign in to comment.