From 75f64e6b71400a3b726dddf09119ac9563bedc45 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Mon, 28 Oct 2024 17:10:54 -0400 Subject: [PATCH] Call find_package(Kokkos) if PETSc is compiled with Kokkos support --- cmake/modules/FindDEAL_II_PETSC.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmake/modules/FindDEAL_II_PETSC.cmake b/cmake/modules/FindDEAL_II_PETSC.cmake index f304cb83cc..445490aed5 100644 --- a/cmake/modules/FindDEAL_II_PETSC.cmake +++ b/cmake/modules/FindDEAL_II_PETSC.cmake @@ -193,6 +193,17 @@ if(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") endif() endforeach() + + # PETSc does not expose Kokkos version, so we need to search for Kokkos + # ourselves. + if(PETSC_WITH_KOKKOS) + file(STRINGS "${PETSC_PETSCVARIABLES}" KOKKOS_INCLUDE + REGEX "^KOKKOS_INCLUDE =.*") + string(REGEX REPLACE "^KOKKOS_INCLUDE = -I" "" KOKKOS_INCLUDE "${KOKKOS_INCLUDE}") + find_package(Kokkos 3.7.0 QUIET + HINTS ${KOKKOS_INCLUDE}/.. + ) + endif() endif() if(PETSC_WITH_MPIUNI) -- 2.39.5