summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-11-23 12:11:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-11-23 12:11:59 (GMT)
commit9b9a42166803e864a8b08c22cadfe8db447acb40 (patch)
tree4ed5e9c2a91d7382d7112d481161fb0ba64743d2
parentc924d33bec26c88fa120396192992cfc3b959039 (diff)
parent989d50d7fc3369955b1008158a110b77d3693b1a (diff)
downloadCMake-9b9a42166803e864a8b08c22cadfe8db447acb40.zip
CMake-9b9a42166803e864a8b08c22cadfe8db447acb40.tar.gz
CMake-9b9a42166803e864a8b08c22cadfe8db447acb40.tar.bz2
Merge topic 'find_cuda_toolkit_support_symlink_math_dirs'
989d50d7fc FindCUDAToolkit: Support nvhpc splayed layouts without symlinks 207518b6e8 FindCUDAToolkit: Handle CUDAToolkit_TARGET_DIR dir being a symlink Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7945
-rw-r--r--Modules/FindCUDAToolkit.cmake13
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 62e54c8..a4cebe4 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -831,11 +831,18 @@ elseif(NOT CUDAToolkit_FIND_QUIETLY)
message(STATUS "Unable to find cuda_runtime.h in \"${CUDAToolkit_TARGET_DIR}/include\" for CUDAToolkit_INCLUDE_DIR.")
endif()
-# The NVHPC layout moves math library headers and libraries to a sibling directory.
+# The NVHPC layout moves math library headers and libraries to a sibling directory and it could be nested under
+# the version of the CUDA toolchain
# Create a separate variable so this directory can be selectively added to math targets.
if(NOT EXISTS "${CUDAToolkit_INCLUDE_DIR}/cublas_v2.h")
- file(REAL_PATH "${CUDAToolkit_TARGET_DIR}/../../" CUDAToolkit_MATH_INCLUDE_DIR)
- cmake_path(APPEND CUDAToolkit_MATH_INCLUDE_DIR "math_libs/include")
+ file(REAL_PATH "${CUDAToolkit_TARGET_DIR}" CUDAToolkit_MATH_INCLUDE_DIR)
+ cmake_path(APPEND CUDAToolkit_MATH_INCLUDE_DIR "../../math_libs/")
+ if(EXISTS "${CUDAToolkit_MATH_INCLUDE_DIR}/${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}/")
+ cmake_path(APPEND CUDAToolkit_MATH_INCLUDE_DIR "${CUDAToolkit_VERSION_MAJOR}.${CUDAToolkit_VERSION_MINOR}/")
+ endif()
+ cmake_path(APPEND CUDAToolkit_MATH_INCLUDE_DIR "include")
+ cmake_path(NORMAL_PATH CUDAToolkit_MATH_INCLUDE_DIR)
+
if(NOT EXISTS "${CUDAToolkit_MATH_INCLUDE_DIR}/cublas_v2.h")
if(NOT CUDAToolkit_FIND_QUIETLY)
message(STATUS "Unable to find cublas_v2.h in either \"${CUDAToolkit_INCLUDE_DIR}\" or \"${CUDAToolkit_MATH_INCLUDE_DIR}\"")