Skip to content

Commit dcbd11a

Browse files
committed
build(aluminum): Add HeFFTe linking with fallbacks
Link HeFFTe explicitly to aluminumNew and aluminumTest since OpenPFC now links it privately. Supports multiple target variants with graceful fallback to find_package. - Add HeFFTe to aluminumNew and aluminumTest link lines - Check for Heffte::Heffte, Heffte, or heffte targets
1 parent a4202b3 commit dcbd11a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

apps/aluminumNew/CMakeLists.txt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
1414
endif()
1515

1616
add_executable(aluminumNew aluminumNew.cpp)
17-
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json)
17+
if(TARGET Heffte::Heffte)
18+
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json Heffte::Heffte)
19+
elseif(TARGET Heffte)
20+
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json Heffte)
21+
elseif(TARGET heffte)
22+
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json heffte)
23+
else()
24+
target_link_libraries(aluminumNew OpenPFC nlohmann_json::nlohmann_json)
25+
endif()
1826

1927
# Only build tests if tests are enabled for the parent project
2028
option(ALUMINUM_ENABLE_TESTS "Enable building Aluminum tests" ON)
@@ -23,7 +31,15 @@ if(ALUMINUM_ENABLE_TESTS AND OpenPFC_BUILD_TESTS)
2331
find_package(Catch2 QUIET)
2432
if(TARGET Catch2::Catch2WithMain)
2533
add_executable(aluminumTest aluminumTest.cpp)
26-
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Catch2::Catch2WithMain)
34+
if(TARGET Heffte::Heffte)
35+
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Heffte::Heffte Catch2::Catch2WithMain)
36+
elseif(TARGET Heffte)
37+
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Heffte Catch2::Catch2WithMain)
38+
elseif(TARGET heffte)
39+
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json heffte Catch2::Catch2WithMain)
40+
else()
41+
target_link_libraries(aluminumTest OpenPFC nlohmann_json::nlohmann_json Catch2::Catch2WithMain)
42+
endif()
2743
include(CTest)
2844
# Run all aluminum tests in a single invocation to avoid per-test MPI overhead
2945
add_test(NAME aluminum-all-tests COMMAND aluminumTest)

0 commit comments

Comments
 (0)