From 0971003539613e2c03625c90dc4fdb7ef9075307 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 27 Jul 2022 14:10:03 -0400 Subject: [PATCH] More robust solution of CMake policy 135 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. --- rapids-cmake/cpm/detail/get_proprietary_binary.cmake | 7 ------- rapids-cmake/cpm/init.cmake | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/rapids-cmake/cpm/detail/get_proprietary_binary.cmake b/rapids-cmake/cpm/detail/get_proprietary_binary.cmake index 5d3278634..01b46d6da 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 140b31c78..9ffd200e1 100644 --- a/rapids-cmake/cpm/init.cmake +++ b/rapids-cmake/cpm/init.cmake @@ -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()