-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathitk-module-init.cmake
More file actions
55 lines (51 loc) · 1.42 KB
/
itk-module-init.cmake
File metadata and controls
55 lines (51 loc) · 1.42 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Find the packages required by this module
#
# Set default Cuda architecture if not provided. The first case allows for
# backward compatibility with cmake versions before 3.20 which did not handle
# CUDAARCHS environment variable.
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
if(DEFINED ENV{CUDAARCHS})
set(
CMAKE_CUDA_ARCHITECTURES
"$ENV{CUDAARCHS}"
CACHE STRING
"CUDA architectures"
)
else()
set(CMAKE_CUDA_ARCHITECTURES "52" CACHE STRING "CUDA architectures")
endif()
endif()
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
set(CUDAToolkit_NVCC_EXECUTABLE ${CMAKE_CUDA_COMPILER})
find_package(CUDAToolkit REQUIRED)
if(NOT CUDAToolkit_FOUND)
message(FATAL_ERROR "CUDAToolkit not found (available since CMake v3.17)")
endif()
endif()
# Configure CUDA compilation options
if(NOT CUDACOMMON_CUDA_VERSION)
set(
CUDACOMMON_CUDA_VERSION
${CUDAToolkit_VERSION}
CACHE STRING
"Specify the exact CUDA version that must be used for CudaCommon"
)
else()
set(
CUDACOMMON_CUDA_VERSION
${CUDACOMMON_CUDA_VERSION}
CACHE STRING
"Specify the exact CUDA version that must be used for CudaCommon"
)
endif()
mark_as_advanced(CUDACOMMON_CUDA_VERSION)
if(CUDAToolkit_FOUND)
enable_language(CUDA)
set(CMAKE_CUDA_RUNTIME_LIBRARY Static)
if(CUDACOMMON_CUDA_VERSION)
find_package(CUDAToolkit EXACT ${CUDACOMMON_CUDA_VERSION} REQUIRED)
endif()
endif()