From 4f10111e950de87106677d309a0f41356eff34af Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 12 May 2023 10:00:32 -0400 Subject: CUDA: Cuda* tests add rpath entry only for need cuda lib directory Found when developing https://github.com/conda-forge/cuda-nvcc-feedstock/pull/13/ We previously added RPATH entries for all implicit directories and therefore started to load the incorrect pthread library. --- Tests/Cuda/Complex/CMakeLists.txt | 3 ++- Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt | 3 ++- Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt | 3 ++- Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt index 63defdf..e252304 100644 --- a/Tests/Cuda/Complex/CMakeLists.txt +++ b/Tests/Cuda/Complex/CMakeLists.txt @@ -53,5 +53,6 @@ endif() if(UNIX) # Help the shared cuda runtime find libcudart as it is not located # in a default system searched location - set_property(TARGET CudaComplexMixedLib PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + find_package(CUDAToolkit REQUIRED) + set_property(TARGET CudaComplexMixedLib PROPERTY BUILD_RPATH "${CUDAToolkit_LIBRARY_DIR}") endif() diff --git a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt index 0b01085..7dc919f 100644 --- a/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt +++ b/Tests/CudaOnly/SharedRuntimePlusToolkit/CMakeLists.txt @@ -40,5 +40,6 @@ target_link_libraries(CudaOnlySharedRuntimePlusToolkit PRIVATE SharedToolkit if(UNIX) # Help the shared cuda runtime find libcudart as it is not located # in a default system searched location - set_property(TARGET CudaOnlySharedRuntimePlusToolkit PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + find_package(CUDAToolkit REQUIRED) + set_property(TARGET CudaOnlySharedRuntimePlusToolkit PROPERTY BUILD_RPATH "${CUDAToolkit_LIBRARY_DIR}") endif() diff --git a/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt index 24ff478..cf6eef2 100644 --- a/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt +++ b/Tests/CudaOnly/SharedRuntimeViaCUDAFlags/CMakeLists.txt @@ -11,5 +11,6 @@ add_executable(CudaOnlySharedRuntimeViaCUDAFlags main.cu) if(UNIX) # Help the shared cuda runtime find libcudart as it is not located # in a default system searched location - set_property(TARGET CudaOnlySharedRuntimeViaCUDAFlags PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + find_package(CUDAToolkit REQUIRED) + set_property(TARGET CudaOnlySharedRuntimeViaCUDAFlags PROPERTY BUILD_RPATH "${CUDAToolkit_LIBRARY_DIR}") endif() diff --git a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt index ae03b66..8149060 100644 --- a/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt +++ b/Tests/CudaOnly/StaticRuntimePlusToolkit/CMakeLists.txt @@ -39,5 +39,6 @@ target_link_libraries(CudaOnlyStaticRuntimePlusToolkit PRIVATE SharedToolkit if(UNIX) # Help the shared cuda runtime find libcurand and libnppif when they are not located # in a default system searched location - set_property(TARGET CudaOnlyStaticRuntimePlusToolkit PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) + find_package(CUDAToolkit REQUIRED) + set_property(TARGET CudaOnlyStaticRuntimePlusToolkit PROPERTY BUILD_RPATH "${CUDAToolkit_LIBRARY_DIR}") endif() -- cgit v0.12