Skip to content
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

[FEA] Use the GitHub .zip URI instead of GIT_REPOSITORY and GIT_BRANCH #257

Merged
merged 6 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 43 additions & 7 deletions RAPIDS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,50 @@
# This is the preferred entry point for projects using rapids-cmake
#

set(rapids-cmake-version 22.10)
# Allow users to control which version is used
if(NOT rapids-cmake-version)
# Define a default version if the user doesn't set one
set(rapids-cmake-version 22.10)
endif()

# Allow users to control which Github repo is fetched
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
if(NOT rapids-cmake-repo)
# Define a default repo if the user doesn't set one
set(rapids-cmake-repo rapidsai/rapids-cmake)
endif()

# Allow users to control which branch is fetched
if(NOT rapids-cmake-branch)
# Define a default branch if the user doesn't set one
set(rapids-cmake-branch "branch-${rapids-cmake-version}")
endif()

# Allow users to control the exact URL passed to FetchContent
if(NOT rapids-cmake-url)
# Construct a default URL if the user doesn't set one
set(rapids-cmake-url "https:/${rapids-cmake-repo}")
# In order of specificity
if(rapids-cmake-sha)
# An exact git SHA takes precedence over anything
string(APPEND rapids-cmake-url "archive/${rapids-cmake-sha}.zip")
elseif(rapids-cmake-tag)
# Followed by a git tag name
string(APPEND rapids-cmake-url "archive/refs/tags/${rapids-cmake-tag}.zip")
else()
# Or if neither of the above two were defined, use a branch
string(APPEND rapids-cmake-url "archive/refs/heads/${rapids-cmake-branch}.zip")
endif()
endif()

if(POLICY CMP0135)
cmake_policy(PUSH)
cmake_policy(SET CMP0135 NEW)
endif()
include(FetchContent)
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
FetchContent_Declare(
rapids-cmake
GIT_REPOSITORY https:/rapidsai/rapids-cmake.git
GIT_TAG branch-${rapids-cmake-version}
)
FetchContent_Declare(rapids-cmake URL "${rapids-cmake-url}")
if(POLICY CMP0135)
cmake_policy(POP)
endif()
FetchContent_GetProperties(rapids-cmake)
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
if(rapids-cmake_POPULATED)
# Something else has already populated rapids-cmake, only thing
Expand All @@ -34,4 +71,3 @@ if(rapids-cmake_POPULATED)
else()
FetchContent_MakeAvailable(rapids-cmake)
endif()

4 changes: 3 additions & 1 deletion rapids-cmake/rapids-version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@
# can't have an include guard on this file
# that breaks its usage by cpm/detail/package_details

set(rapids-cmake-version 22.10)
if(NOT DEFINED rapids-cmake-version)
set(rapids-cmake-version 22.10)
endif()