From 3fddc6880b7cc7a5b7e40047d7bab748a50c4f8f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 27 Jul 2022 19:47:31 -0400 Subject: [PATCH] More robust solution of CMake policy 135 (#224) 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. Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: None URL: https://github.com/rapidsai/rapids-cmake/pull/224 --- rapids-cmake/cpm/detail/get_proprietary_binary.cmake | 7 ------- rapids-cmake/cpm/init.cmake | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rapids-cmake/cpm/detail/get_proprietary_binary.cmake b/rapids-cmake/cpm/detail/get_proprietary_binary.cmake index 5d327863..01b46d6d 100644 --- a/rapids-cmake/cpm/detail/get_proprietary_binary.cmake +++ b/rapids-cmake/cpm/detail/get_proprietary_binary.cmake @@ -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}) diff --git a/rapids-cmake/cpm/init.cmake b/rapids-cmake/cpm/init.cmake index 140b31c7..752be6cc 100644 --- a/rapids-cmake/cpm/init.cmake +++ b/rapids-cmake/cpm/init.cmake @@ -61,6 +61,13 @@ 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()