CMakeCUDAArchitecturesValidate.cmake 910 B

12345678910111213141516171819
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. function(cmake_cuda_architectures_validate lang)
  4. if(DEFINED CMAKE_${lang}_ARCHITECTURES)
  5. if(CMAKE_${lang}_ARCHITECTURES STREQUAL "")
  6. message(FATAL_ERROR "CMAKE_${lang}_ARCHITECTURES must be non-empty if set.")
  7. elseif(CMAKE_${lang}_ARCHITECTURES AND NOT CMAKE_${lang}_ARCHITECTURES MATCHES "^([0-9]+a?(-real|-virtual)?(;[0-9]+a?(-real|-virtual)?|;)*|all|all-major|native)$")
  8. message(FATAL_ERROR
  9. "CMAKE_${lang}_ARCHITECTURES:\n"
  10. " ${CMAKE_${lang}_ARCHITECTURES}\n"
  11. "is not one of the following:\n"
  12. " * a semicolon-separated list of integers, each optionally\n"
  13. " followed by '-real' or '-virtual'\n"
  14. " * a special value: all, all-major, native\n"
  15. )
  16. endif()
  17. endif()
  18. endfunction()