diff options
author | Brad King <brad.king@kitware.com> | 2020-04-16 15:11:06 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-16 15:11:33 (GMT) |
commit | 7e8df1bb24dcde30d1baafb23f6ab26352e67763 (patch) | |
tree | a3e3cf4c3b11924100f3a0235033b980faefae0d /Modules/CMakeDetermineCUDACompiler.cmake | |
parent | 854cc83a76a021301c49ae27cbd8924a2b5c97a5 (diff) | |
parent | 21131ca60cd37cdd306c10781df254e261f27c8a (diff) | |
download | CMake-7e8df1bb24dcde30d1baafb23f6ab26352e67763.zip CMake-7e8df1bb24dcde30d1baafb23f6ab26352e67763.tar.gz CMake-7e8df1bb24dcde30d1baafb23f6ab26352e67763.tar.bz2 |
Merge topic 'cuda_architectures'
21131ca60c CUDA: Add CudaOnly.CompileFlags test
f0931b0790 CUDA: Convert tests to use CUDA_ARCHITECTURES
e98588aaba CUDA: Add CUDA_ARCHITECTURES target property
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Patrick Stotko <stotko@cs.uni-bonn.de>
Merge-request: !4568
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 55ca800..ead4125 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -226,6 +226,17 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n") endif() + + # Parse default CUDA architecture. + cmake_policy(GET CMP0104 _CUDA_CMP0104) + if(NOT CMAKE_CUDA_ARCHITECTURES AND _CUDA_CMP0104 STREQUAL "NEW") + string(REGEX MATCH "arch[ =]compute_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") + set(CMAKE_CUDA_ARCHITECTURES "${CMAKE_MATCH_1}" CACHE STRING "CUDA architectures") + + if(NOT CMAKE_CUDA_ARCHITECTURES) + message(FATAL_ERROR "Failed to find default CUDA architecture.") + endif() + endif() endif() # configure all variables set in this file |