Skip to content

Commit

Permalink
Update to CPM with fix for FETCHCONTENT_BASE_DIR (#386)
Browse files Browse the repository at this point in the history
Update CPM with a [fix for `FETCHCONTENT_BASE_DIR`](cpm-cmake/CPM.cmake#244).

Authors:
  - Paul Taylor (https://github.com/trxcllnt)

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

URL: #386
  • Loading branch information
trxcllnt authored Apr 19, 2021
1 parent d7cbb99 commit 728e0fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
23 changes: 7 additions & 16 deletions cpp/cmake/thirdparty/CUSPATIAL_GetCPM.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set(CPM_DOWNLOAD_VERSION 3b404296b539e596f39421c4e92bc803b299d964) # v0.27.5
set(CPM_DOWNLOAD_VERSION 7644c3a40fc7889f8dee53ce21e85dc390b883dc) # v0.32.1

if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
Expand All @@ -9,28 +11,17 @@ else()
endif()

if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "CUSPATIAL: Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
message(VERBOSE "CUSPATIAL: Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(
DOWNLOAD
https://raw.githubusercontent.com/TheLartians/CPM.cmake/${CPM_DOWNLOAD_VERSION}/cmake/CPM.cmake
https://raw.githubusercontent.com/cpm-cmake/CPM.cmake/${CPM_DOWNLOAD_VERSION}/cmake/CPM.cmake
${CPM_DOWNLOAD_LOCATION})
endif()

include(${CPM_DOWNLOAD_LOCATION})

function(cuspatial_save_if_enabled var)
if(CUSPATIAL_${var})
unset(${var} PARENT_SCOPE)
unset(${var} CACHE)
endif()
endfunction()

function(cuspatial_restore_if_enabled var)
if(CUSPATIAL_${var})
set(${var} ON CACHE INTERNAL "" FORCE)
endif()
endfunction()

# If a target is installed, found by the `find_package` step of CPMFindPackage,
# and marked as IMPORTED, make it globally accessible to consumers of our libs.
function(fix_cmake_global_defaults target)
if(TARGET ${target})
get_target_property(_is_imported ${target} IMPORTED)
Expand Down
4 changes: 0 additions & 4 deletions cpp/cmake/thirdparty/CUSPATIAL_GetCUDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ function(find_and_configure_cudf VERSION)
return()
endif()

cuspatial_save_if_enabled(BUILD_TESTS)
cuspatial_save_if_enabled(BUILD_BENCHMARKS)
CPMFindPackage(NAME cudf
VERSION ${VERSION}
GIT_REPOSITORY https://github.com/rapidsai/cudf.git
Expand All @@ -31,8 +29,6 @@ function(find_and_configure_cudf VERSION)
OPTIONS "BUILD_TESTS OFF"
"BUILD_BENCHMARKS OFF"
FIND_PACKAGE_ARGUMENTS "COMPONENTS testing")
cuspatial_restore_if_enabled(BUILD_TESTS)
cuspatial_restore_if_enabled(BUILD_BENCHMARKS)

# Make sure consumers of cuspatial can see cudf::cudf
fix_cmake_global_defaults(cudf::cudf)
Expand Down

0 comments on commit 728e0fd

Please sign in to comment.