Skip to content

In conda-build produced binaries, use paths relative to $PREFIX #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 21, 2025
13 changes: 12 additions & 1 deletion rapids-cmake/cmake/support_conda_env.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=============================================================================
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
# Copyright (c) 2021-2025, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -164,6 +164,17 @@ function(rapids_cmake_support_conda_env target)
"$<HOST_LINK:SHELL:LINKER:-rpath-link=$ENV{BUILD_PREFIX}/lib>")
endif()

# Make all paths like `$PREFIX/<path>` relative to `$PREFIX` so `<path>`.
target_compile_options(${target}
INTERFACE "$<$<COMPILE_LANGUAGE:C>:-ffile-prefix-map=$ENV{PREFIX}/=''>"
)
target_compile_options(${target}
INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:-ffile-prefix-map=$ENV{PREFIX}/=''>"
)
target_compile_options(${target}
INTERFACE "$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-ffile-prefix-map=$ENV{PREFIX}/=''>"
)

if(modify_prefix_path)
message(VERBOSE "Conda build detected")
set(prefix_paths "$ENV{PREFIX}" "$ENV{BUILD_PREFIX}")
Expand Down