diff options
author | Raul Tambre <raul@tambre.ee> | 2020-09-14 11:27:56 (GMT) |
---|---|---|
committer | Raul Tambre <raul@tambre.ee> | 2020-09-14 11:40:32 (GMT) |
commit | 2c0d5d01ee8b129116acec2fb359e7e6514876cb (patch) | |
tree | 84a532782b16be62cefb820fbfacebd6f3cb44c6 | |
parent | 71133488ef0480ccdeaac5e6692a257c93661469 (diff) | |
download | CMake-2c0d5d01ee8b129116acec2fb359e7e6514876cb.zip CMake-2c0d5d01ee8b129116acec2fb359e7e6514876cb.tar.gz CMake-2c0d5d01ee8b129116acec2fb359e7e6514876cb.tar.bz2 |
CUDA: Support scattered installations when crosscompiling with Clang
Previously when CMAKE_CROSSCOMPILING was ON we'd end up not setting the target
directory if the non-scattered one didn't exist.
Fix this by assuming a scattered installation if the target directory isn't set
after the crosscompiling logic.
-rw-r--r-- | Help/release/dev/cuda-clang-scattered-cross.rst | 5 | ||||
-rw-r--r-- | Modules/CMakeDetermineCUDACompiler.cmake | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/Help/release/dev/cuda-clang-scattered-cross.rst b/Help/release/dev/cuda-clang-scattered-cross.rst new file mode 100644 index 0000000..7278dcb --- /dev/null +++ b/Help/release/dev/cuda-clang-scattered-cross.rst @@ -0,0 +1,5 @@ +cuda-clang-scattered-cross +-------------------------- + +* Scattered toolkit installations are now recognized when crosscompiling + ``CUDA`` using Clang. diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index 6bdd06b..e60a973 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -300,7 +300,7 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") endforeach() endif() - # Find target directory. Account for crosscompiling. + # Find target directory when crosscompiling. if(CMAKE_CROSSCOMPILING) if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a") # Support for NVPACK @@ -320,7 +320,10 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/targets/${_CUDA_TARGET_NAME}") set(_CUDA_TARGET_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/targets/${_CUDA_TARGET_NAME}") endif() - else() + endif() + + # If not already set we can simply use the toolkit root or it's a scattered installation. + if(NOT _CUDA_TARGET_DIR) set(_CUDA_TARGET_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}") endif() |