rapids_cmake_support_conda_env

Added in version v21.06.00.

Establish a target that holds the necessary compile and link information to properly support building in CONDA envs.

rapids_cmake_support_conda_env( <target_name> [MODIFY_PREFIX_PATH] )

Creates a global interface target called target_name that holds the CONDA compile options, include directories, and link directories when executed.

Added in version v24.06.00.

The include directories that target_name holds will be -isystem to match the behavior of conda when it builds projects.

Added in version v24.08.00.

The target_name target will add the required compile flags to ensure debug builds are generated with -O0 instead of the conda env default of -O2.

Added in version v25.06.00.

The flag -ffile-prefix-map is now passed to remap absolute paths starting with $ENV{PREFIX} to paths relative to it in binaries generated via compilation. This ensures paths baked into binaries are relative to the environment prefix. This prevents Conda from rewriting these paths when the package is installed.

Also offers the ability to modify CMAKE_PREFIX_PATH to include the following paths based on the current conda environment:

  • PREFIX

  • BUILD_PREFIX

  • CONDA_PREFIX

Added in version v23.08.00:

  • PREFIX/targets/<cuda_target_platform>/

MODIFY_PREFIX_PATH

When in a conda build environment the contents of $ENV{PREFIX}, $ENV{PREFIX}/targets/<cuda_target_platform>/, and `$ENV{BUILD_PREFIX} will be inserted to the front of CMAKE_PREFIX_PATH.

When in a conda environment the contents of $ENV{CONDA_PREFIX} will be inserted to the front of CMAKE_PREFIX_PATH.

Result Variables

CMAKE_PREFIX_PATH will be modified when MODIFY_PREFIX_PATH is provided and called from a conda environment.

Result Targets

target_name target will be created only if called from a conda environment.