summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/EnableStandard/CMakeLists.txt
blob: dfcb8da41bb81aec834d549584ad1bc014167625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

cmake_minimum_required(VERSION 3.7)
project (EnableStandard CUDA)

#Goal for this example:
#build cuda sources that require C++11 to be enabled.

add_library(CUDAStatic11 STATIC static.cu)
add_library(CUDADynamic11 SHARED shared.cu)

add_executable(CudaOnlyEnableStandard main.cu)
target_link_libraries(CudaOnlyEnableStandard PRIVATE CUDAStatic11 CUDADynamic11)

target_compile_features(CUDADynamic11 PRIVATE cuda_std_11)
set_target_properties(CUDAStatic11 PROPERTIES CUDA_STANDARD 11)
set_target_properties(CUDAStatic11 PROPERTIES CUDA_STANDARD_REQUIRED TRUE)

#Verify CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
foreach(dir ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
  if(NOT IS_DIRECTORY "${dir}")
    message(FATAL_ERROR
      "CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES entry\n"
      " ${dir}\n"
      "is not an existing directory."
      )
  endif()
endforeach()