diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-11-22 14:02:08 (GMT) |
---|---|---|
committer | Robert Maynard <rmaynard@nvidia.com> | 2022-11-22 14:02:08 (GMT) |
commit | 989d50d7fc3369955b1008158a110b77d3693b1a (patch) | |
tree | 4886052b67a8bf79a36cdb085e4987e3b47206c5 | |
parent | 207518b6e8c0d254b8ae190ed62343917acf86e0 (diff) | |
download | CMake-989d50d7fc3369955b1008158a110b77d3693b1a.zip CMake-989d50d7fc3369955b1008158a110b77d3693b1a.tar.gz CMake-989d50d7fc3369955b1008158a110b77d3693b1a.tar.bz2 |
FindCUDAToolkit: Support nvhpc splayed layouts without symlinks
-rw-r--r-- | Modules/FindCUDAToolkit.cmake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 68515c4..03722ce 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -831,12 +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") + 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}\"") |