diff options
author | Brad King <brad.king@kitware.com> | 2020-06-18 19:52:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-18 19:53:45 (GMT) |
commit | 90be0916b549e806f6e72eb3ca2d8237a1adf174 (patch) | |
tree | 77428a69735968cd54cd962b4664676488448b8f /Modules/CMakeDetermineCUDACompiler.cmake | |
parent | 4ab5f109f0f755a91aa89f8242481ea25989ffbd (diff) | |
download | CMake-90be0916b549e806f6e72eb3ca2d8237a1adf174.zip CMake-90be0916b549e806f6e72eb3ca2d8237a1adf174.tar.gz CMake-90be0916b549e806f6e72eb3ca2d8237a1adf174.tar.bz2 |
CUDA: Re-order some logic for determining the compiler
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 598c270..15eebf7 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -51,20 +51,13 @@ endif() if(NOT CMAKE_CUDA_COMPILER_ID_RUN) set(CMAKE_CUDA_COMPILER_ID_RUN 1) - # Try to identify the compiler. - set(CMAKE_CUDA_COMPILER_ID) - set(CMAKE_CUDA_PLATFORM_ID) - file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in - CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT) + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + # We determine the vendor to help with find the toolkit and use the right flags for detection right away. + # The main compiler identification is still needed below to extract other information. list(APPEND CMAKE_CUDA_COMPILER_ID_VENDORS NVIDIA Clang) set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_NVIDIA "nvcc: NVIDIA \\(R\\) Cuda compiler driver") set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)") - - set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v") - - # We determine the vendor to help with find the toolkit and use the right flags for detection right away. - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) CMAKE_DETERMINE_COMPILER_ID_VENDOR(CUDA "--version") # Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT and CMAKE_CUDA_COMPILER_LIBRARY_ROOT @@ -184,6 +177,8 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda") endif() + set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v") + if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") set(nvcc_test_flags "--keep --keep-dir tmp") if(CMAKE_CUDA_HOST_COMPILER) @@ -234,7 +229,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN) # We also use it to verify that CMAKE_CUDA_ARCHITECTURES and additionaly on Clang that CUDA toolkit path works. # The latter could be done during compiler testing in the future to avoid doing this for Clang. # We need to unset the compiler ID otherwise CMAKE_DETERMINE_COMPILER_ID() doesn't work. - unset(CMAKE_CUDA_COMPILER_ID) + set(CMAKE_CUDA_COMPILER_ID) + set(CMAKE_CUDA_PLATFORM_ID) + file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in + CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT) CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu) |