Skip to content
Snippets Groups Projects
Commit 248922ac authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Add check and error message for cuda availability

parent 8f72f45c
No related branches found
No related tags found
No related merge requests found
# project name and specify the minumum cmake version.
cmake_minimum_required (VERSION 3.11)
project (psrdada_cpp CXX)
# Compiling and build options
option(ENABLE_CUDA " Compile with .cu and .cuh files the nvcc compiler. Requires CUDA toolkit to be installed." ON)
option(ENABLE_TESTING "Build and enable testing" ON)
......@@ -8,13 +9,19 @@ option(ENABLE_BENCHMARK "Build and enable benchmark" OFF)
option(BUILD_SUBMODULES "Build submodules" ON)
option(BUILD_DADAFLOW "Build dadaflow" OFF)
if(ENABLE_CUDA)
project (psrdada_cpp CXX CUDA)
include(CheckLanguage)
check_language(CUDA)
if(ENABLE_CUDA AND NOT CMAKE_CUDA_COMPILER)
message(FATAL_ERROR "Cuda enabled but no cuda compiler found. Either specify CMAKE_CUDA_COMPILER manually or set ENABLE_CUDA=FALSE")
endif()
if(ENABLE_CUDA AND CMAKE_CUDA_COMPILER)
enable_language(CUDA)
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "75;80;89")
endif()
elseif(NOT ENABLE_CUDA)
project (psrdada_cpp CXX)
endif()
# The version number.
......
  • Maintainer

    According to this article project (psrdada_cpp CXX CUDA) should not be used when CUDA is optional.

    Edited by Niclas Esser
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment