Skip to content

Commit

Permalink
More robust solution of CMake policy 135
Browse files Browse the repository at this point in the history
By enabling CMake policy 135 we ensure that extracted files timestamp match that of the download time, instead of when the
archive is created. This makes sure that if the URL changes to an older version we still rebuild everything as the timestamp
stays newer.
  • Loading branch information
robertmaynard committed Jul 27, 2022
1 parent f2c6292 commit 0971003
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 0 additions & 7 deletions rapids-cmake/cpm/detail/get_proprietary_binary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ function(rapids_cpm_get_proprietary_binary package_name version)
include(FetchContent)
set(pkg_name "${package_name}_proprietary_binary")

# Prefer to use the download time for timestamp, instead of the timestamp in the archive unless
# explicitly set by user. This allows for proper rebuilds when a projects url changes
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
endif()

FetchContent_Declare(${pkg_name} URL ${proprietary_binary})
FetchContent_MakeAvailable(${pkg_name})

Expand Down
8 changes: 8 additions & 0 deletions rapids-cmake/cpm/init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ function(rapids_cpm_init)
rapids_cpm_package_override("${_RAPIDS_OVERRIDE}")
endif()

# Prefer to use the download time for timestamp, instead of the timestamp in the archive unless
# explicitly set by user. This allows for proper rebuilds when a projects url changes
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW CACHE STRING "")
endif()


include("${rapids-cmake-dir}/cpm/detail/download.cmake")
rapids_cpm_download()

Expand Down

0 comments on commit 0971003

Please sign in to comment.