mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-12 01:09:47 -06:00
CUDA: Improve error message when CMAKE_CUDA_ARCHITECTURES contains quotes
Closes: #27150
This commit is contained in:
@@ -5,6 +5,11 @@ function(cmake_cuda_architectures_validate lang)
|
||||
if(DEFINED CMAKE_${lang}_ARCHITECTURES)
|
||||
if(CMAKE_${lang}_ARCHITECTURES STREQUAL "")
|
||||
message(FATAL_ERROR "CMAKE_${lang}_ARCHITECTURES must be non-empty if set.")
|
||||
elseif(CMAKE_${lang}_ARCHITECTURES MATCHES [["]])
|
||||
message(FATAL_ERROR
|
||||
"CMAKE_${lang}_ARCHITECTURES contains literal quotes:\n"
|
||||
" ${CMAKE_${lang}_ARCHITECTURES}\n"
|
||||
)
|
||||
elseif(CMAKE_${lang}_ARCHITECTURES AND NOT CMAKE_${lang}_ARCHITECTURES MATCHES "^([0-9]+(a|f)?(-real|-virtual)?(;[0-9]+(a|f)?(-real|-virtual)?|;)*|all|all-major|native)$")
|
||||
message(FATAL_ERROR
|
||||
"CMAKE_${lang}_ARCHITECTURES:\n"
|
||||
|
||||
@@ -5,6 +5,7 @@ run_cmake(architectures-all-major)
|
||||
run_cmake(architectures-native)
|
||||
run_cmake(architectures-empty)
|
||||
run_cmake(architectures-invalid)
|
||||
run_cmake(architectures-quotes)
|
||||
|
||||
run_cmake(architectures-not-set)
|
||||
include("${RunCMake_BINARY_DIR}/architectures-not-set-build/info.cmake" OPTIONAL)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,10 @@
|
||||
^CMake Error at .*/Internal/CMakeCUDAArchitecturesValidate\.cmake:[0-9]+ \(message\):
|
||||
CMAKE_CUDA_ARCHITECTURES contains literal quotes:
|
||||
|
||||
"all-major"
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
[^
|
||||
]*/Modules/CMakeDetermineCUDACompiler.cmake:[0-9]+ \(cmake_cuda_architectures_validate\)
|
||||
architectures-quotes\.cmake:2 \(enable_language\)
|
||||
CMakeLists\.txt:3 \(include\)$
|
||||
@@ -0,0 +1,2 @@
|
||||
set(CMAKE_CUDA_ARCHITECTURES "\"all-major\"")
|
||||
enable_language(CUDA)
|
||||
Reference in New Issue
Block a user