diff --git a/cmake/EkatConfig.cmake.in b/cmake/EkatConfig.cmake.in index 1de980c5..41fd1e29 100644 --- a/cmake/EkatConfig.cmake.in +++ b/cmake/EkatConfig.cmake.in @@ -16,30 +16,31 @@ endif() if (@EKAT_ENABLE_KOKKOS@) # Kokkos - if (@Kokkos_FOUND@) - find_dependency(Kokkos REQUIRED QUIET HINTS @Kokkos_DIR@) - else() + if (@EKAT_BUILDS_KOKKOS@) # We're installing Kokkos alongside ekat find_dependency(Kokkos REQUIRED QUIET HINTS @CMAKE_INSTALL_PREFIX@) + else() + find_dependency(Kokkos REQUIRED QUIET HINTS @Kokkos_DIR@) endif() endif() # yaml-cpp if (@EKAT_ENABLE_YAML_PARSER@) - if (@yaml-cpp_FOUND@) - find_dependency(yaml-cpp REQUIRED QUIET HINTS @yaml-cpp_DIR@) - else() + if (@EKAT_BUILDS_YAMLCPP@) # We're installing yaml-cpp alongside ekat find_dependency(yaml-cpp REQUIRED QUIET HINTS @CMAKE_INSTALL_PREFIX@) + else() + find_dependency(yaml-cpp REQUIRED QUIET HINTS @yaml-cpp_DIR@) endif() endif() if (@EKAT_ENABLE_LOGGING@) # spdlog - if (@spdlog_FOUND@) - find_dependency(spdlog REQUIRED QUIET HINTS @spdlog_DIR@) - else() + if (@EKAT_BUILDS_SPDLOG@) + # We're installing yaml-cpp alongside ekat find_dependency(spdlog REQUIRED QUIET HINTS @CMAKE_INSTALL_PREFIX@) + else() + find_dependency(spdlog REQUIRED QUIET HINTS @spdlog_DIR@) endif() endif() diff --git a/cmake/machine-files/kokkos/generic.cmake b/cmake/machine-files/kokkos/generic.cmake index 8e04ec2c..c61a6de6 100644 --- a/cmake/machine-files/kokkos/generic.cmake +++ b/cmake/machine-files/kokkos/generic.cmake @@ -1,4 +1,4 @@ # Generic setting that are used regardless of Architecture or Kokkos backend -set(Kokkos_ENABLE_DEPRECATED_CODE FALSE CACHE BOOL "") +set(Kokkos_ENABLE_DEPRECATED_CODE_4 FALSE CACHE BOOL "") set(Kokkos_ENABLE_EXPLICIT_INSTANTIATION FALSE CACHE BOOL "") diff --git a/cmake/tpls/EkatFindKokkos.cmake b/cmake/tpls/EkatFindKokkos.cmake index c96ac733..0cff1837 100644 --- a/cmake/tpls/EkatFindKokkos.cmake +++ b/cmake/tpls/EkatFindKokkos.cmake @@ -72,21 +72,18 @@ if (Kokkos_FOUND) list (FIND Kokkos_DEVICES ${dev} index) if (index EQUAL -1) list (APPEND MISSING_DEVICES ${dev}) - set (Kokkos_FOUND FALSE) endif() endforeach() foreach (arch IN ITEMS ${EKAT_FIND_KOKKOS_ARCHS}) list (FIND Kokkos_ARCH ${arch} index) if (index EQUAL -1) list (APPEND MISSING_ARCHS ${arch}) - set (Kokkos_FOUND FALSE) endif() endforeach() foreach (opt IN ITEMS ${EKAT_FIND_KOKKOS_OPTIONS}) list (FIND Kokkos_OPTIONS ${opt} index) if (index EQUAL -1) list (APPEND MISSING_OPTIONS ${arch}) - set (Kokkos_FOUND FALSE) endif() endforeach() diff --git a/src/kokkos/CMakeLists.txt b/src/kokkos/CMakeLists.txt index 691837bd..854654f1 100644 --- a/src/kokkos/CMakeLists.txt +++ b/src/kokkos/CMakeLists.txt @@ -7,12 +7,16 @@ if (EKAT_SKIP_FIND_KOKKOS) # The user does not want to accidentally get an existing installation, # and instead wants to force a build from the internal submodule include (EkatBuildKokkos) + set (EKAT_BUILDS_KOKKOS ON CACHE BOOL "Whether Ekat builds kokkos" FORCE) else() # We first try to use find_package (unless told to skip this phase). # If that doesn't work, build from submodule include (EkatFindKokkos) if (NOT Kokkos_FOUND) include (EkatBuildKokkos) + set (EKAT_BUILDS_KOKKOS ON CACHE BOOL "Whether Ekat builds kokkos" FORCE) + else() + set (EKAT_BUILDS_KOKKOS OFF CACHE BOOL "Whether Ekat builds kokkos" FORCE) endif() endif() diff --git a/src/logging/CMakeLists.txt b/src/logging/CMakeLists.txt index ada5c63c..3e61e385 100644 --- a/src/logging/CMakeLists.txt +++ b/src/logging/CMakeLists.txt @@ -7,6 +7,7 @@ if (EKAT_SKIP_FIND_SPDLOG) # The user does not want to accidentally get an existing installation, # and instead wants to force a build from the internal submodule include (EkatBuildSpdlog) + set (EKAT_BUILDS_SPDLOG ON CACHE BOOL "Whether Ekat builds spdlog" FORCE) else() # We first try to use find_XYZ. If that doesn't work, build from submodule message (STATUS "Looking for spdlog ...") @@ -14,9 +15,11 @@ else() if (NOT spdlog_FOUND) message (STATUS "Looking for spdlog ... NOT FOUND") include(EkatBuildSpdlog) + set (EKAT_BUILDS_SPDLOG ON CACHE BOOL "Whether Ekat builds spdlog" FORCE) else() message (STATUS "Looking for spdlog ... FOUND") message (STATUS " spdlog_DIR: ${spdlog_DIR}") + set (EKAT_BUILDS_SPDLOG OFF CACHE BOOL "Whether Ekat builds spdlog" FORCE) endif() endif() diff --git a/src/parser/CMakeLists.txt b/src/parser/CMakeLists.txt index 4e71b1b3..5d3194f2 100644 --- a/src/parser/CMakeLists.txt +++ b/src/parser/CMakeLists.txt @@ -6,6 +6,7 @@ if (EKAT_SKIP_FIND_YAML_CPP) # The user does not want to accidentally get an existing installation, # and instead wants to force a build from the internal submodule include (EkatBuildYamlCpp) + set (EKAT_BUILDS_YAMLCPP ON CACHE BOOL "Whether Ekat builds yaml-cpp" FORCE) else() # I am having issues getting the env var YAML_CPP_ROOT being picked up # by cmake. I suspect this has to do with the presence of the hyphen @@ -21,7 +22,9 @@ else() if (NOT yaml-cpp_FOUND) message (STATUS "Looking for yaml-cpp ... NOT FOUND") include(EkatBuildYamlCpp) + set (EKAT_BUILDS_YAMLCPP ON CACHE BOOL "Whether Ekat builds yaml-cpp" FORCE) else() + set (EKAT_BUILDS_YAMLCPP OFF CACHE BOOL "Whether Ekat builds yaml-cpp" FORCE) message (STATUS "Looking for yaml-cpp ... FOUND") message (STATUS " yaml-cpp_DIR: ${yaml-cpp_DIR}") # It is possible that the installation provides the yaml-cpp target, but not the yaml-cpp::yaml-cpp target. If so, define the alias target