Skip to content

Commit 83132ef

Browse files
committed
fix(aluminum): respect parent project test settings in CMakeLists
- Only build aluminumTest when both ALUMINUM_ENABLE_TESTS and OpenPFC_BUILD_TESTS are enabled - Use find_package(Catch2 QUIET) instead of REQUIRED to avoid failure when tests are disabled - Change WARNING to STATUS for missing Catch2 message - Fixes CI documentation workflow that builds with tests disabled
1 parent 1a2ecf2 commit 83132ef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/aluminumNew/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ endif()
1616
add_executable(aluminumNew aluminumNew.cpp)
1717
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json)
1818

19+
# Only build tests if tests are enabled for the parent project
1920
option(ALUMINUM_ENABLE_TESTS "Enable building Aluminum tests" ON)
2021

21-
if(ALUMINUM_ENABLE_TESTS)
22-
find_package(Catch2 REQUIRED)
22+
if(ALUMINUM_ENABLE_TESTS AND OpenPFC_BUILD_TESTS)
23+
find_package(Catch2 QUIET)
2324
if(TARGET Catch2::Catch2WithMain)
2425
add_executable(aluminumTest aluminumTest.cpp)
2526
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Catch2::Catch2WithMain)
2627
include(CTest)
2728
include(Catch)
2829
catch_discover_tests(aluminumTest)
2930
else()
30-
message(WARNING "Aluminum: Catch2 not found, not building tests")
31+
message(STATUS "Aluminum: Catch2 not found, not building tests")
3132
endif()
3233
endif()
3334

0 commit comments

Comments
 (0)