diff options
| author | Thijs Paelman <thijs@ouroboros.rocks> | 2025-11-03 22:40:55 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-11-07 08:35:48 +0100 |
| commit | ed8a62f1cdca19c09caf52f2e36f45dafaa9cff8 (patch) | |
| tree | e3bde26d332953eb205885a37870068bd5e3a11f | |
| parent | 181739aa4571b8707160b946f1e1e3a92a3c3e3b (diff) | |
| download | ouroboros-ed8a62f1cdca19c09caf52f2e36f45dafaa9cff8.tar.gz ouroboros-ed8a62f1cdca19c09caf52f2e36f45dafaa9cff8.zip | |
build: Only add tests when BUILD_TESTING is ON
By default, BUILD_TESTING = ON due to the inclusion of the CTest module.
Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
| -rw-r--r-- | CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/ipcpd/local/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/ipcpd/unicast/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | src/irmd/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/irmd/reg/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/lib/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/tools/irm/CMakeLists.txt | 4 |
7 files changed, 24 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ffa5bf4..cd2bffee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,7 +179,10 @@ else () message(STATUS "Systemd service installation disabled by user") endif() -enable_testing() +include(CTest) # Sets BUILD_TESTING by default to on. +# BUILD_TESTS: control if tests are included by CMAKE. +# Can depend on more than only BUILD_TESTING in the future. +set(BUILD_TESTS ${BUILD_TESTING}) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) find_package(ProtobufC QUIET) diff --git a/src/ipcpd/local/CMakeLists.txt b/src/ipcpd/local/CMakeLists.txt index 08abff57..f661e9ae 100644 --- a/src/ipcpd/local/CMakeLists.txt +++ b/src/ipcpd/local/CMakeLists.txt @@ -31,4 +31,6 @@ endif () install(TARGETS ipcpd-local RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) # Enable once ipcp-local has tests -# add_subdirectory(tests) +# if(BUILD_TESTS) +# add_subdirectory(tests) +# endif () diff --git a/src/ipcpd/unicast/CMakeLists.txt b/src/ipcpd/unicast/CMakeLists.txt index ced045e6..a9155353 100644 --- a/src/ipcpd/unicast/CMakeLists.txt +++ b/src/ipcpd/unicast/CMakeLists.txt @@ -71,6 +71,8 @@ endif () install(TARGETS ipcpd-unicast RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) -add_subdirectory(pff/tests) -add_subdirectory(routing/tests) -add_subdirectory(dir/tests) +if(BUILD_TESTS) + add_subdirectory(pff/tests) + add_subdirectory(routing/tests) + add_subdirectory(dir/tests) +endif () diff --git a/src/irmd/CMakeLists.txt b/src/irmd/CMakeLists.txt index 46d49391..32904d59 100644 --- a/src/irmd/CMakeLists.txt +++ b/src/irmd/CMakeLists.txt @@ -109,4 +109,6 @@ endif () install(TARGETS irmd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) add_subdirectory(reg) -add_subdirectory(tests) +if(BUILD_TESTS) + add_subdirectory(tests) +endif () diff --git a/src/irmd/reg/CMakeLists.txt b/src/irmd/reg/CMakeLists.txt index ff9d2e99..d3844908 100644 --- a/src/irmd/reg/CMakeLists.txt +++ b/src/irmd/reg/CMakeLists.txt @@ -4,4 +4,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_BINARY_DIR}/include) -add_subdirectory(tests) +if(BUILD_TESTS) + add_subdirectory(tests) +endif () diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 04a8f089..14e89976 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -333,4 +333,6 @@ target_include_directories(ouroboros-dev PUBLIC ${CMAKE_CURRENT_BINARY_DIR} target_include_directories(ouroboros-irm PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${SYS_RND_HDR} ${LIBGCRYPT_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}) -add_subdirectory(tests) +if(BUILD_TESTS) + add_subdirectory(tests) +endif () diff --git a/src/tools/irm/CMakeLists.txt b/src/tools/irm/CMakeLists.txt index 7acd5396..3c599300 100644 --- a/src/tools/irm/CMakeLists.txt +++ b/src/tools/irm/CMakeLists.txt @@ -39,4 +39,6 @@ target_link_libraries(irm LINK_PUBLIC ouroboros-irm) install(TARGETS irm RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) # enable when we have tests -# add_subdirectory(tests) +# if(BUILD_TESTS) +# add_subdirectory(tests) +# endif () |
