Skip to content

Commit

Permalink
Define optional targets as components
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Nov 7, 2024
1 parent 4836868 commit 62f9f6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
include(CMakeFindDependencyMacro)

set(DDC_BUILD_DOUBLE_PRECISION @DDC_BUILD_DOUBLE_PRECISION@)
set(DDC_BUILD_KERNELS_FFT @DDC_BUILD_KERNELS_FFT@)
set(DDC_BUILD_KERNELS_SPLINES @DDC_BUILD_KERNELS_SPLINES@)
set(DDC_BUILD_PDI_WRAPPER @DDC_BUILD_PDI_WRAPPER@)

find_package(Kokkos 4.4...4.5)

Expand Down Expand Up @@ -40,4 +37,10 @@ foreach(target core fft pdi splines)
endif()
endforeach()

foreach(target_component fft pdi splines)
if(TARGET DDC::impl::ddc_${target_component})
set(DDC_${target_component}_FOUND TRUE)
endif()
endforeach()

check_required_components(DDC)
8 changes: 4 additions & 4 deletions install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
cmake_minimum_required(VERSION 3.22)
project(test-installed-ddc LANGUAGES CXX)

find_package(DDC REQUIRED)
find_package(DDC REQUIRED COMPONENTS fft pdi splines)

message("DDC options:")
message("DDC_BUILD_DOUBLE_PRECISION=${DDC_BUILD_DOUBLE_PRECISION}")
message("DDC_BUILD_KERNELS_FFT=${DDC_BUILD_KERNELS_FFT}")
message("DDC_BUILD_KERNELS_SPLINES=${DDC_BUILD_KERNELS_SPLINES}")
message("DDC_BUILD_PDI_WRAPPER=${DDC_BUILD_PDI_WRAPPER}")
message("DDC_fft_FOUND=${DDC_fft_FOUND}")
message("DDC_splines_FOUND=${DDC_splines_FOUND}")
message("DDC_pdi_FOUND=${DDC_pdi_FOUND}")

add_executable(main main.cpp)
target_link_libraries(main PRIVATE DDC::core DDC::fft DDC::pdi DDC::splines)

0 comments on commit 62f9f6b

Please sign in to comment.