Skip to content

Commit

Permalink
make it easier to include rmm in other projects (#788)
Browse files Browse the repository at this point in the history
Right now if we want to include RMM in other cmake projects using CPM, we'd have to do something like this:
```cmake
CPMAddPackage(
    NAME rmm
    GIT_REPOSITORY https://github.com/rapidsai/rmm
    GIT_TAG 0cc1380
    OPTIONS "BUILD_TESTS OFF" "BUILD_BENCHMARKS OFF"
)
```
With this change, it can be done using the short form:
```cmake
CPMAddPackage("gh:rapidsai/rmm#0cc1380523d31b2f044ecc74b457b228f8aea0c8")
```
This is also the recommendation from `Modern CMake` (https://cliutils.gitlab.io/modern-cmake/chapters/testing.html).

Authors:
  - Rong Ou (https://github.com/rongou)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - Keith Kraus (https://github.com/kkraus14)

URL: #788
  • Loading branch information
rongou authored Jun 1, 2021
1 parent 47f5522 commit 783ed6d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ set_property(CACHE RMM_LOGGING_LEVEL PROPERTY STRINGS "TRACE" "DEBUG" "INFO" "WA
"CRITICAL" "OFF")
message(STATUS "RMM: RMM_LOGGING_LEVEL = '${RMM_LOGGING_LEVEL}'")

if(BUILD_TESTS OR BUILD_BENCHMARKS)
if((BUILD_TESTS OR BUILD_BENCHMARKS) AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Auto-detect available GPU compute architectures
include(${RMM_SOURCE_DIR}/cmake/Modules/SetGPUArchs.cmake)
# Enable the CUDA language after setting CMAKE_CUDA_ARCHITECTURES
Expand All @@ -103,16 +103,16 @@ endif()

# optionally build tests

if(BUILD_TESTS)
if(BUILD_TESTS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
enable_testing()
add_subdirectory(tests)
endif(BUILD_TESTS)
endif()

# add google benchmark

if(BUILD_BENCHMARKS)
if(BUILD_BENCHMARKS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(benchmarks)
endif(BUILD_BENCHMARKS)
endif()

# install targets

Expand Down

0 comments on commit 783ed6d

Please sign in to comment.