From 354daab7c5aa8bbbc3434befe59044b2217cce60 Mon Sep 17 00:00:00 2001 From: HRN Date: Mon, 17 Feb 2025 18:39:33 +0330 Subject: [PATCH] now accepts both kokkos on Home folder and automatic download --- cmake/preReq.cmake | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/cmake/preReq.cmake b/cmake/preReq.cmake index 5d8c4c24..57690a91 100644 --- a/cmake/preReq.cmake +++ b/cmake/preReq.cmake @@ -23,19 +23,25 @@ endif() cmake_policy(SET CMP0169 OLD) -include(FetchContent) +# Kokkos folder creation +set(Kokkos_Source_DIR $ENV{HOME}/Kokkos/kokkos) -FetchContent_Declare( - kokkos - GIT_REPOSITORY https://github.com/kokkos/kokkos.git - GIT_TAG 4.3.01 -) +if(NOT EXISTS "${Kokkos_Source_DIR}/CMakeLists.txt") + + include(FetchContent) + FetchContent_Declare( + kokkos + GIT_REPOSITORY https://github.com/kokkos/kokkos.git + GIT_TAG 4.3.01 + ) + + FetchContent_GetProperties(kokkos) + if(NOT kokkos_POPULATED) + message(STATUS "Kokkos source directory not found. Downloading Kokkos version 4.3.01 ...") + FetchContent_Populate(kokkos) + set(Kokkos_Source_DIR ${kokkos_SOURCE_DIR}) + endif() -FetchContent_GetProperties(kokkos) -if(NOT kokkos_POPULATED) - message(STATUS "Kokkos source directory not found. Downloading Kokkos version 4.3.01 ...") - FetchContent_Populate(kokkos) - set(Kokkos_Source_DIR ${kokkos_SOURCE_DIR}) endif() message(STATUS "Kokkos source directory is ${Kokkos_Source_DIR}")