Merge pull request #5340 from multitalentloes/cmakeversion_bugfix

Lower CMake version

Resolves #5339.
This commit is contained in:
Bård Skaflestad 2024-05-08 16:20:52 +02:00 committed by GitHub
commit 633728b590
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@
# Mandatory call to project
cmake_minimum_required (VERSION 3.21)
cmake_minimum_required (VERSION 3.10)
project(opm-simulators C CXX)
@ -35,7 +35,8 @@ option(USE_BDA_BRIDGE "Enable the BDA bridge (GPU/AMGCL solvers)" ON)
option(USE_TRACY_PROFILER "Enable tracy profiling" OFF)
option(CONVERT_CUDA_TO_HIP "Convert CUDA code to HIP (to run on AMD cards)" OFF)
if (CONVERT_CUDA_TO_HIP)
# HIP requires cmake version 3.21
if (CONVERT_CUDA_TO_HIP AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.21")
enable_language(HIP)
message("CUDA code will be hipified")
set(HAVE_CUDA 1) # we still need this defined so that the preprocessor does not remove the code
@ -45,6 +46,8 @@ if (CONVERT_CUDA_TO_HIP)
find_package(hipsparse REQUIRED)
find_package(hipblas REQUIRED)
link_libraries(roc::hipblas roc::hipsparse)
elseif(CONVERT_CUDA_TO_HIP)
message("To generate HIP code for AMD GPUs run CMake with version >= 3.21")
endif()
# The following was copied from CMakeLists.txt in opm-common.