summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/EnableStandard/CMakeLists.txt
blob: 54e2c14132389618a6b1c84b926c225a8b906ce9 (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

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)

set_target_properties(CUDAStatic11 CUDADynamic11 PROPERTIES CUDA_STANDARD 11)
set_target_properties(CUDAStatic11 CUDADynamic11 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()