diff options
author | Brad King <brad.king@kitware.com> | 2022-03-01 17:15:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-01 17:16:40 (GMT) |
commit | 2796d6eeca3d2507f12bc10db82a945a773419a2 (patch) | |
tree | cad205ee315d17de107d269c96cd8fb6201c3a27 /Modules/CMakeDetermineCUDACompiler.cmake | |
parent | e450d555524195e95ea140838a2b7f06caad6b1b (diff) | |
download | CMake-2796d6eeca3d2507f12bc10db82a945a773419a2.zip CMake-2796d6eeca3d2507f12bc10db82a945a773419a2.tar.gz CMake-2796d6eeca3d2507f12bc10db82a945a773419a2.tar.bz2 |
CUDA: Fix CMAKE_CUDA_ARCHITECTURES=all/all-major with NVCC 11.5+
Changes in commit 8f64df0a7c (CUDA: Generic all and all-major support,
2021-12-19, v3.23.0-rc1~23^2) broke our architecture verification checks
when using `-arch={all,all-major}` with NVCC 11.5+. If we test the
compiler with `-arch={all,all-major}`, we have no expected list of
architectures, so skip the check.
Fixes: #23278
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index d8fc66f..f491c79 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -279,6 +279,7 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) # For others select based on version. if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND CMAKE_CUDA_COMPILER_TOOLKIT_VERSION VERSION_GREATER_EQUAL 11.5) string(APPEND nvcc_test_flags " -arch=${CMAKE_CUDA_ARCHITECTURES}") + set(architectures_tested "${CMAKE_CUDA_ARCHITECTURES}") elseif(NOT CMAKE_GENERATOR MATCHES "Visual Studio") if(CMAKE_CUDA_ARCHITECTURES STREQUAL "all") set(architectures_test ${CMAKE_CUDA_ARCHITECTURES_ALL}) @@ -630,7 +631,7 @@ if("${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "") message(FATAL_ERROR "Failed to detect a default CUDA architecture.\n\nCompiler output:\n${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}") endif() endif() -else() +elseif(NOT "${architectures_tested}" MATCHES "^(all|all-major)$") # Sort since order mustn't matter. list(SORT architectures_detected) list(SORT architectures_tested) @@ -671,6 +672,8 @@ unset(_CUDA_TARGET_DIR) unset(_CUDA_TARGET_NAME) unset(architectures_explicit) +unset(architectures_detected) +unset(architectures_tested) set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX") set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX") |