From a6c49af32d516a2ea147ddedc098a2c9f2558d02 Mon Sep 17 00:00:00 2001 From: Christopher Mauney Date: Mon, 7 Aug 2023 14:17:40 -0600 Subject: [PATCH 1/5] put guards on exported config --- config/singularity-eosConfig.cmake.in | 48 +++++++++++++++++---------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/config/singularity-eosConfig.cmake.in b/config/singularity-eosConfig.cmake.in index 55c4c24e6a3..d3826dd0f49 100644 --- a/config/singularity-eosConfig.cmake.in +++ b/config/singularity-eosConfig.cmake.in @@ -35,37 +35,49 @@ endif() # ------------------------------------------------------------------------------# # library dependencies # ------------------------------------------------------------------------------# -find_package(ports-of-call REQUIRED) -find_package(mpark_variant REQUIRED) +if(NOT TARGET ports-of-call::ports-of-call) + find_package(ports-of-call REQUIRED) +endif() + +if(NOT TARGET mpark_variant) + find_package(mpark_variant REQUIRED) +endif() -if(@SINGULARITY_USE_SPINER@) +if(@SINGULARITY_USE_SPINER@ AND NOT TARGET spiner::spiner) find_package(spiner REQUIRED) - if(@SINGULARITY_USE_SPINER_WITH_HDF5@) +endif() + +if(@SINGULARITY_USE_SPINER_WITH_HDF5@) + if(NOT TARGET HDF5::HDF5 OR NOT HDF5_LIBRARIES) find_package( HDF5 COMPONENTS C HL REQUIRED) - if(@SINGULARITY_USE_SPINER_WITH_PARALLEL_HDF5@) - # do i need enable_language here? - find_package( - MPI - COMPONENTS C CXX - REQUIRED) - endif() - set(SPINER_USE_HDF ON) endif() + set(SPINER_USE_HDF ON) +endif() + +if(@SINGULARITY_USE_SPINER_WITH_PARALLEL_HDF5@ AND NOT TARGET MPI::MPI_CXX) + # do i need enable_language here? + find_package( + MPI + COMPONENTS C CXX + REQUIRED) endif() -if(@SINGULARITY_USE_KOKKOS@) +if(@SINGULARITY_USE_KOKKOS@ AND NOT TARGET Kokkos::kokkos) find_package(Kokkos REQUIRED) - if(@SINGULARITY_USE_KOKKOSKERNELS@) - find_package(KokkosKernels REQUIRED) - endif() -else() +endif() + +if(@SINGULARITY_USE_KOKKOSKERNELS@ AND NOT TARGET Kokkos::kokkoskernels) + find_package(KokkosKernels REQUIRED) +endif() + +if(@SINGULARITY_USE_EIGEN@ AND NOT TARGET Eigen3::Eigen) find_package(Eigen3 REQUIRED) endif() -if(@SINGULARITY_USE_EOSPAC@) +if(@SINGULARITY_USE_EOSPAC@ AND NOT TARGET EOSPAC::eospac) find_package(EOSPAC REQUIRED) endif() From 551c2129ecc5d7d30bc1d13fd9f293b67076cacd Mon Sep 17 00:00:00 2001 From: Christopher Mauney Date: Mon, 7 Aug 2023 14:56:50 -0600 Subject: [PATCH 2/5] changed a typo --- cmake/singularity-eos/hdf5.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/singularity-eos/hdf5.cmake b/cmake/singularity-eos/hdf5.cmake index 26e5de27db3..83f58e5fdb2 100644 --- a/cmake/singularity-eos/hdf5.cmake +++ b/cmake/singularity-eos/hdf5.cmake @@ -79,7 +79,9 @@ macro(singularity_enable_hdf5 target) COMPONENTS C CXX REQUIRED) target_link_libraries(${target} PUBLIC MPI::MPI_CXX) - set(SINGLUARITY_USE_SPINER_WITH_PARALLEL_HDF5 TRUE) + set(SINGULARITY_USE_SPINER_WITH_PARALLEL_HDF5 + ON + CACHE BOOL "" FORCE) endif() target_compile_definitions(${target} PUBLIC SINGULARITY_USE_HDF5) From f878ee6977586fd94221f9a870092e1aa8fe64b2 Mon Sep 17 00:00:00 2001 From: Christopher Mauney Date: Mon, 7 Aug 2023 14:58:28 -0600 Subject: [PATCH 3/5] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1abdabc27..e809e3ed126 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [[PR269]](https://github.com/lanl/singularity-eos/pull/269) Add SAP Polynomial EoS ### Fixed (Repair bugs, etc) +- [[PR290]](https://github.com/lanl/singularity-eos/pull/290) Added target guards on export config - [[PR288]](https://github.com/lanl/singularity-eos/pull/288) Don't build tests that depend on spiner when spiner is disabled - [[PR287]](https://github.com/lanl/singularity-eos/pull/287) Fix testing logic with new HDF5 options - [[PR282]](https://github.com/lanl/singularity-eos/pull/282) Fix missing deep copy in sap polynomial tests From 26897774edb4d3195a14c710a7834b6794f7807b Mon Sep 17 00:00:00 2001 From: Christopher Mauney Date: Mon, 7 Aug 2023 15:13:06 -0600 Subject: [PATCH 4/5] use find_dependency in export config --- config/singularity-eosConfig.cmake.in | 45 +++++++++++---------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/config/singularity-eosConfig.cmake.in b/config/singularity-eosConfig.cmake.in index d3826dd0f49..62e1f32dacc 100644 --- a/config/singularity-eosConfig.cmake.in +++ b/config/singularity-eosConfig.cmake.in @@ -35,50 +35,41 @@ endif() # ------------------------------------------------------------------------------# # library dependencies # ------------------------------------------------------------------------------# -if(NOT TARGET ports-of-call::ports-of-call) - find_package(ports-of-call REQUIRED) -endif() -if(NOT TARGET mpark_variant) - find_package(mpark_variant REQUIRED) -endif() +include(CMakeFindDependencyMacro) + +find_dependency(ports-of-call) + +find_dependency(mpark_variant) -if(@SINGULARITY_USE_SPINER@ AND NOT TARGET spiner::spiner) - find_package(spiner REQUIRED) +if(@SINGULARITY_USE_SPINER@) + find_dependency(spiner) endif() if(@SINGULARITY_USE_SPINER_WITH_HDF5@) - if(NOT TARGET HDF5::HDF5 OR NOT HDF5_LIBRARIES) - find_package( - HDF5 - COMPONENTS C HL - REQUIRED) - endif() + find_dependency(HDF5 COMPONENTS C HL) set(SPINER_USE_HDF ON) endif() -if(@SINGULARITY_USE_SPINER_WITH_PARALLEL_HDF5@ AND NOT TARGET MPI::MPI_CXX) +if(@SINGULARITY_USE_SPINER_WITH_PARALLEL_HDF5@) # do i need enable_language here? - find_package( - MPI - COMPONENTS C CXX - REQUIRED) + find_dependency(MPI COMPONENTS C CXX) endif() -if(@SINGULARITY_USE_KOKKOS@ AND NOT TARGET Kokkos::kokkos) - find_package(Kokkos REQUIRED) +if(@SINGULARITY_USE_KOKKOS@) + find_dependency(Kokkos) endif() -if(@SINGULARITY_USE_KOKKOSKERNELS@ AND NOT TARGET Kokkos::kokkoskernels) - find_package(KokkosKernels REQUIRED) +if(@SINGULARITY_USE_KOKKOSKERNELS@) + find_dependency(KokkosKernels) endif() -if(@SINGULARITY_USE_EIGEN@ AND NOT TARGET Eigen3::Eigen) - find_package(Eigen3 REQUIRED) +if(@SINGULARITY_USE_EIGEN@) + find_dependency(Eigen3) endif() -if(@SINGULARITY_USE_EOSPAC@ AND NOT TARGET EOSPAC::eospac) - find_package(EOSPAC REQUIRED) +if(@SINGULARITY_USE_EOSPAC@) + find_dependency(EOSPAC) endif() # ------------------------------------------------------------------------------# From da0c7f6e8c695fd4416e5b0d0255f1086237a123 Mon Sep 17 00:00:00 2001 From: Christopher Mauney Date: Mon, 7 Aug 2023 16:42:29 -0600 Subject: [PATCH 5/5] added EOSPAC specific guard --- config/singularity-eosConfig.cmake.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/singularity-eosConfig.cmake.in b/config/singularity-eosConfig.cmake.in index 62e1f32dacc..7557387ab2f 100644 --- a/config/singularity-eosConfig.cmake.in +++ b/config/singularity-eosConfig.cmake.in @@ -69,7 +69,10 @@ if(@SINGULARITY_USE_EIGEN@) endif() if(@SINGULARITY_USE_EOSPAC@) - find_dependency(EOSPAC) + # needed for EOSPAC + if(NOT TARGET EOSPAC::eospac) + find_dependency(EOSPAC) + endif() endif() # ------------------------------------------------------------------------------#