Skip to content

Commit

Permalink
support_conda_env only add rpath-link flag to linkers that support it. (
Browse files Browse the repository at this point in the history
#384)

Fixes #383

Authors:
  - Robert Maynard (https://github.com/robertmaynard)

Approvers:
  - Paul Taylor (https://github.com/trxcllnt)

URL: #384
  • Loading branch information
robertmaynard authored Mar 8, 2023
1 parent 9599638 commit 900b9e7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions rapids-cmake/cmake/support_conda_env.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,14 @@ function(rapids_cmake_support_conda_env target)
target_include_directories(${target} INTERFACE "$ENV{PREFIX}/include"
"$ENV{BUILD_PREFIX}/include")
target_link_directories(${target} INTERFACE "$ENV{PREFIX}/lib" "$ENV{BUILD_PREFIX}/lib")
target_link_options(${target} INTERFACE
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{PREFIX}/lib>")
target_link_options(${target} INTERFACE
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{BUILD_PREFIX}/lib>")

if(DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG
OR DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG)
target_link_options(${target} INTERFACE
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{PREFIX}/lib>")
target_link_options(${target} INTERFACE
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{BUILD_PREFIX}/lib>")
endif()

if(modify_prefix_path)
list(PREPEND CMAKE_PREFIX_PATH "$ENV{PREFIX}" "$ENV{BUILD_PREFIX}")
Expand All @@ -92,8 +96,11 @@ function(rapids_cmake_support_conda_env target)
elseif(in_conda_prefix)
target_include_directories(${target} INTERFACE "$ENV{CONDA_PREFIX}/include")
target_link_directories(${target} INTERFACE "$ENV{CONDA_PREFIX}/lib")
target_link_options(${target} INTERFACE
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{CONDA_PREFIX}/lib>")
if(DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG
OR DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG)
target_link_options(${target} INTERFACE
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{CONDA_PREFIX}/lib>")
endif()

if(modify_prefix_path)
list(PREPEND CMAKE_PREFIX_PATH "$ENV{CONDA_PREFIX}")
Expand Down

0 comments on commit 900b9e7

Please sign in to comment.