summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorDan Ibanez <daibane@sandia.gov>2021-06-29 20:38:03 -0600
committerBrad King <brad.king@kitware.com>2021-07-01 12:18:27 -0400
commitd9301458417acefc4f325796b3672b5039171961 (patch)
treee6bd65bb077560f1657aa763796f0e6bd0ada019 /Modules
parentd837efafa56c39c75de3d66c964d002a39a58301 (diff)
downloadcmake-d9301458417acefc4f325796b3672b5039171961.tar.gz
FindCUDATookit: Fix ordering of libraries in imported targets
Before this a downstream code linking to `CUDA::cusparse_static` and `CUDA::curand_static` would get a link line with `libcusparse_static.a`, then `libculibos.a`, then `libcurand_static.a`. Use `IMPORTED_LOCATION` to tell CMake about the proper dependency ordering where `libculibos.a` comes last, because the other two libraries depend on `libculibos.a`. Fixes: #22365
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindCUDAToolkit.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 8801cb1bff..4c535b9f24 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -844,9 +844,9 @@ if(CUDAToolkit_FOUND)
mark_as_advanced(CUDA_${lib_name}_LIBRARY)
if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY)
- add_library(CUDA::${lib_name} IMPORTED INTERFACE)
+ add_library(CUDA::${lib_name} UNKNOWN IMPORTED)
target_include_directories(CUDA::${lib_name} SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}")
- target_link_libraries(CUDA::${lib_name} INTERFACE "${CUDA_${lib_name}_LIBRARY}")
+ set_property(TARGET CUDA::${lib_name} PROPERTY IMPORTED_LOCATION "${CUDA_${lib_name}_LIBRARY}")
foreach(dep ${arg_DEPS})
if(TARGET CUDA::${dep})
target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dep})