diff options
author | Raul Tambre <raul@tambre.ee> | 2020-11-24 17:21:36 (GMT) |
---|---|---|
committer | Raul Tambre <raul@tambre.ee> | 2020-11-30 15:57:11 (GMT) |
commit | c4ae9384ff4d355f51c06180984dd4d053f074cc (patch) | |
tree | 521f3e008bf3dee883e08d2605774d14cbefeb21 /Modules/CMakeDetermineCUDACompiler.cmake | |
parent | 8187bd2f4bc54c9003cb0034b21530e3bfd24e8d (diff) | |
download | CMake-c4ae9384ff4d355f51c06180984dd4d053f074cc.zip CMake-c4ae9384ff4d355f51c06180984dd4d053f074cc.tar.gz CMake-c4ae9384ff4d355f51c06180984dd4d053f074cc.tar.bz2 |
CUDA: Initialize CMAKE_CUDA_ARCHITECTURES using $ENV{CUDAARCHS}
NVCC's default architecture may be newer than the one supported by the
machine's GPU.
In such cases it's useful to have an environment variable for initializing
CMAKE_CUDA_ARCHITECTURES to avoid specifying it for every invocation.
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 972adef..578729c 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -47,6 +47,10 @@ if(NOT $ENV{CUDAHOSTCXX} STREQUAL "") endif() endif() +if(NOT "$ENV{CUDAARCHS}" STREQUAL "") + set(CMAKE_CUDA_ARCHITECTURES "$ENV{CUDAARCHS}" CACHE STRING "CUDA architectures") +endif() + # Build a small source file to identify the compiler. if(NOT CMAKE_CUDA_COMPILER_ID_RUN) set(CMAKE_CUDA_COMPILER_ID_RUN 1) |