diff options
author | Brad King <brad.king@kitware.com> | 2023-09-18 17:38:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-21 19:34:28 (GMT) |
commit | b3a1f175677016d4314793f91e255f384c320ec7 (patch) | |
tree | 3ab8a9009b6cef87345f175abd4bebfd20e4080e /Modules/Internal | |
parent | 8617c28221cac2bd89402178b25dcd47445a9349 (diff) | |
download | CMake-b3a1f175677016d4314793f91e255f384c320ec7.zip CMake-b3a1f175677016d4314793f91e255f384c320ec7.tar.gz CMake-b3a1f175677016d4314793f91e255f384c320ec7.tar.bz2 |
CUDA: Factor out helper to validate CMAKE_CUDA_ARCHITECTURES
Prepare to use it for other languages.
Diffstat (limited to 'Modules/Internal')
-rw-r--r-- | Modules/Internal/CMakeCUDAArchitecturesValidate.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake b/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake new file mode 100644 index 0000000..b6997d2 --- /dev/null +++ b/Modules/Internal/CMakeCUDAArchitecturesValidate.cmake @@ -0,0 +1,19 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +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 AND NOT CMAKE_${lang}_ARCHITECTURES MATCHES "^([0-9]+a?(-real|-virtual)?(;[0-9]+a?(-real|-virtual)?|;)*|all|all-major|native)$") + message(FATAL_ERROR + "CMAKE_${lang}_ARCHITECTURES:\n" + " ${CMAKE_${lang}_ARCHITECTURES}\n" + "is not one of the following:\n" + " * a semicolon-separated list of integers, each optionally\n" + " followed by '-real' or '-virtual'\n" + " * a special value: all, all-major, native\n" + ) + endif() + endif() +endfunction() |