From b5c6a85e2e6067ff9d9e3274694ebfca1a6004a8 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Fri, 21 Mar 2025 08:41:09 -0400 Subject: [PATCH] fix Kokkos inside Trilinos detection --- cmake/modules/FindDEAL_II_KOKKOS.cmake | 5 +++++ cmake/modules/FindDEAL_II_TRILINOS.cmake | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/cmake/modules/FindDEAL_II_KOKKOS.cmake b/cmake/modules/FindDEAL_II_KOKKOS.cmake index cdcbfb4258..ad923fd20f 100644 --- a/cmake/modules/FindDEAL_II_KOKKOS.cmake +++ b/cmake/modules/FindDEAL_II_KOKKOS.cmake @@ -47,7 +47,12 @@ endif() if(Kokkos_FOUND) + if(NOT Kokkos_VERSION) + message(FATAL_ERROR "FindPackage(Kokkos) did not set Kokkos_VERSION!") + endif() + if (Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_HIP) + message(STATUS "Found Kokkos with device support.") # In version older than 3.7.0, Kokkos::Array::operator[] is not constexpr, # so we use std::array instead. if (Kokkos_VERSION VERSION_LESS 3.7.0) diff --git a/cmake/modules/FindDEAL_II_TRILINOS.cmake b/cmake/modules/FindDEAL_II_TRILINOS.cmake index 7ff28686dd..faedde1e90 100644 --- a/cmake/modules/FindDEAL_II_TRILINOS.cmake +++ b/cmake/modules/FindDEAL_II_TRILINOS.cmake @@ -114,6 +114,15 @@ if(TRILINOS_VERSION VERSION_GREATER_EQUAL 14) list(APPEND _targets Kokkos::kokkos) endif() + # run find_package to populate variables like Kokkos_VERSION not + # set by the find_package call to Trilinos: + set(CMAKE_CXX_EXTENSIONS OFF) + find_package(Kokkos 3.7.0 QUIET + HINTS ${TRILINOS_DIR} NO_DEFAULT_PATH + ) + + set(KOKKOS_FOUND ${Kokkos_FOUND}) + process_feature(TRILINOS TARGETS REQUIRED _targets CLEAR -- 2.39.5