From 62f9f6bb154c459073cc05fb1d9893feed50f738 Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Fri, 1 Nov 2024 10:17:24 +0100 Subject: [PATCH] Define optional targets as components --- cmake/DDCConfig.cmake.in | 9 ++++++--- install_test/CMakeLists.txt | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cmake/DDCConfig.cmake.in b/cmake/DDCConfig.cmake.in index 634d24bb3..a2d1db5e9 100644 --- a/cmake/DDCConfig.cmake.in +++ b/cmake/DDCConfig.cmake.in @@ -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) @@ -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) diff --git a/install_test/CMakeLists.txt b/install_test/CMakeLists.txt index 99273e3e1..6fb3d211f 100644 --- a/install_test/CMakeLists.txt +++ b/install_test/CMakeLists.txt @@ -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)