Skip to content

Commit

Permalink
Add missing variables to pre-configured packages
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmaynard committed Aug 5, 2021
1 parent 7c2d6b9 commit d7f03c4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
17 changes: 14 additions & 3 deletions rapids-cmake/cpm/rmm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ rapids_cpm_rmm

.. versionadded:: v21.10.00

Allow projects to find or build `rmm` via `CPM` with built-in
Allow projects to find or build `RMM` via `CPM` with built-in
tracking of these dependencies for correct export support.

Uses the current rapids-cmake version of rmm `as specified in the version file <cpm_versions>`
Uses the current rapids-cmake version of RMM `as specified in the version file <cpm_versions>`
for consistency across all RAPIDS projects.

.. code-block:: cmake
Expand All @@ -42,13 +42,19 @@ for consistency across all RAPIDS projects.
our install directory export set.

.. note::
Installation of rmm will always occur when it is built as a subcomponent of the
Installation of RMM will always occur when it is built as a subcomponent of the
calling project.

Result Targets
^^^^^^^^^^^^^^
rmm::rmm target will be created

Result Variables
^^^^^^^^^^^^^^^^
:cmake:variable:`rmm_SOURCE_DIR` is set to the path to the source directory of RMM.
:cmake:variable:`rmm_BINAR_DIR` is set to the path to the build directory of RMM.
:cmake:variable:`rmm_ADDED` is set to a true value if RMM has not been added before.

#]=======================================================================]
function(rapids_cpm_rmm)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.rmm")
Expand All @@ -71,5 +77,10 @@ function(rapids_cpm_rmm)
GIT_SHALLOW ${shallow}
OPTIONS "BUILD_TESTS OFF" "BUILD_BENCHMARKS OFF")

# Propagate up variables that CPMFindPackage provide
set(rmm_SOURCE_DIR "${rmm_SOURCE_DIR}" PARENT_SCOPE)
set(rmm_BINARY_DIR "${rmm_BINARY_DIR}" PARENT_SCOPE)
set(rmm_ADDED "${rmm_ADDED}" PARENT_SCOPE)

# rmm creates the correct namespace aliases
endfunction()
12 changes: 12 additions & 0 deletions rapids-cmake/cpm/spdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Result Targets
^^^^^^^^^^^^^^
spdlog::spdlog, spdlog::spdlog_header_only targets will be created

Result Variables
^^^^^^^^^^^^^^^^
:cmake:variable:`spdlog_SOURCE_DIR` is set to the path to the source directory of spdlog.
:cmake:variable:`spdlog_BINAR_DIR` is set to the path to the build directory of spdlog.
:cmake:variable:`spdlog_ADDED` is set to a true value if spdlog has not been added before.

#]=======================================================================]
function(rapids_cpm_spdlog)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.spdlog")
Expand All @@ -69,4 +75,10 @@ function(rapids_cpm_spdlog)
GIT_SHALLOW ${shallow}
OPTIONS "spdlog_INSTALL ${to_install}")

# Propagate up variables that CPMFindPackage provide
set(spdlog_SOURCE_DIR "${spdlog_SOURCE_DIR}" PARENT_SCOPE)
set(spdlog_BINARY_DIR "${spdlog_BINARY_DIR}" PARENT_SCOPE)
set(spdlog_ADDED "${spdlog_ADDED}" PARENT_SCOPE)

# spdlog creates the correct namespace aliases
endfunction()
11 changes: 11 additions & 0 deletions rapids-cmake/cpm/thrust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ Result Targets
^^^^^^^^^^^^^^
<namespace>::Thrust target will be created

Result Variables
^^^^^^^^^^^^^^^^
:cmake:variable:`Thrust_SOURCE_DIR` is set to the path to the source directory of Thrust.
:cmake:variable:`Thrust_BINAR_DIR` is set to the path to the build directory of Thrust.
:cmake:variable:`Thrust_ADDED` is set to a true value if Thrust has not been added before.

#]=======================================================================]
function(rapids_cpm_thrust NAMESPACE namespaces_name)
list(APPEND CMAKE_MESSAGE_CONTEXT "rapids.cpm.thrust")
Expand All @@ -79,4 +85,9 @@ function(rapids_cpm_thrust NAMESPACE namespaces_name)
thrust_create_target(${namespaces_name}::Thrust FROM_OPTIONS)
endif()

# Propagate up variables that CPMFindPackage provide
set(Thrust_SOURCE_DIR "${Thrust_SOURCE_DIR}" PARENT_SCOPE)
set(Thrust_BINARY_DIR "${Thrust_BINARY_DIR}" PARENT_SCOPE)
set(Thrust_ADDED "${Thrust_ADDED}" PARENT_SCOPE)

endfunction()

0 comments on commit d7f03c4

Please sign in to comment.