From 11f23b7364c4d15ae80f9d8cb06463e751cd6aab Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Wed, 25 Sep 2024 18:23:42 -0600 Subject: [PATCH] cleanup various little cmake things that were causing problems --- cmake/SetupDeps.cmake | 30 +++++++++++++++++++----------- cmake/SetupOptions.cmake | 6 ++++-- test/CMakeLists.txt | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/cmake/SetupDeps.cmake b/cmake/SetupDeps.cmake index deb3c51..99e1ba0 100644 --- a/cmake/SetupDeps.cmake +++ b/cmake/SetupDeps.cmake @@ -10,6 +10,25 @@ else() message(status "CUDA::toolkit provided by parent package") endif() +#======================================= +# Setup Kokkos +# - provides Kokkos::kokkos +#======================================= +if (SINGULARITY_USE_KOKKOS) + if (NOT TARGET Kokkos::kokkos) + message(status "Kokkos::kokkos must be found") + if (SINGULARITY_KOKKOS_IN_TREE) + message(status "Using in-tree Kokkos") + add_subdirectory(utils/kokkos) + else() + message(status "Using system Kokkos if available") + find_package(Kokkos REQUIRED) + endif() + else() + message(status "Kokkos::kokkos provided by parent package") + endif() +endif() + #======================================= # Setup ports of call # - provides PortsofCall::PortsofCall @@ -17,17 +36,6 @@ endif() find_package(PortsofCall REQUIRED) target_link_libraries(singularity-opac::flags INTERFACE PortsofCall::PortsofCall) -#======================================= -# Setup Kokkos -# - provides Kokkos::kokkos -#======================================= -if (NOT TARGET Kokkos::kokkos) - add_subdirectory(utils/kokkos) - find_package(Kokkos QUIET) -else() - message(status "Kokkos::kokkos provided by parent package") -endif() - #======================================= # Find HDF5 # - cmake@3.20+ provides HDF5::HDF5, but diff --git a/cmake/SetupOptions.cmake b/cmake/SetupOptions.cmake index 21a857c..c8f6ced 100644 --- a/cmake/SetupOptions.cmake +++ b/cmake/SetupOptions.cmake @@ -17,11 +17,13 @@ option (SINGULARITY_USE_FMATH "Enable fast-math logarithms" ON) # Dependency options #======================================= # check for using in-tree third-party dependencies -option (SINULARITY_KOKKOS_IN_TREE "Use in-tree dependencies" OFF) - option (SINGULARITY_USE_KOKKOS "Use Kokkos for portability" OFF) option (SINGULARITY_USE_CUDA "Enable cuda support" OFF) option (SINGULARITY_USE_HDF5 "Pull in hdf5" OFF) +cmake_dependent_option(SINULARITY_KOKKOS_IN_TREE + "Use in-tree dependencies" OFF + ${SINGULARITY_USE_KOKKOS} OFF) + # If the conditional is TRUE, it's the first default, else it's the # second. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 47f13e3..21be197 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,7 +59,7 @@ PRIVATE # Ensure code works with C++11 and earlier # TODO(MM): Remove this later when it's not needed. set_target_properties(${PROJECT_NAME}_unit_tests - PROPERTIES CXX_STANDARD 14 + PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO)