Skip to content

Commit 306633d

Browse files
committed
Fix AluminumNew tests
1 parent 358000c commit 306633d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

apps/aluminumNew/CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
88
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
99
find_package(nlohmann_json REQUIRED)
1010
set(CMAKE_CXX_STANDARD 17)
11-
find_package(Catch2)
1211
endif()
1312

1413
add_executable(aluminumNew aluminumNew.cpp)
1514
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json)
1615

17-
if(TARGET Catch2::Catch2WithMain)
18-
add_executable(aluminumTest aluminumTest.cpp)
19-
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Catch2::Catch2WithMain)
20-
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
21-
include(CTest)
22-
catch_discover_tests(aluminumTest)
23-
else()
24-
message(STATUS "Aluminum: Catch2 not found, not building tests")
16+
option(ALUMINUM_ENABLE_TESTS "Enable building Aluminum tests" ON)
17+
18+
if(ALUMINUM_ENABLE_TESTS)
19+
find_package(Catch2 REQUIRED)
20+
if(TARGET Catch2::Catch2WithMain)
21+
add_executable(aluminumTest aluminumTest.cpp)
22+
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Catch2::Catch2WithMain)
23+
include(CTest)
24+
include(Catch)
25+
catch_discover_tests(aluminumTest)
26+
else()
27+
message(WARNING "Aluminum: Catch2 not found, not building tests")
28+
endif()
2529
endif()
2630

2731
install(TARGETS aluminumNew DESTINATION bin)

0 commit comments

Comments
 (0)