aminya / project_options

A general-purpose CMake library that provides functions that improve the CMake experience following the best practices.

Home Page:https://aminya.github.io/project_options/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmake policy warnings

dvirtz opened this issue · comments

Hi. I've upgraded to a new VS build tools which has CMake 3.24 and started getting the following warning

[cmake] CMake Warning (dev) at C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.24/Modules/FetchContent.cmake:1264 (message):
[cmake]   The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
[cmake]   not set.  The policy's OLD behavior will be used.  When using a URL
[cmake]   download, the timestamps of extracted files should preferably be that of
[cmake]   the time of extraction, otherwise code that depends on the extracted
[cmake]   contents might not be rebuilt if the URL changes.  The OLD behavior
[cmake]   preserves the timestamps from the archive instead, but this is usually not
[cmake]   what you want.  Update your project to the NEW behavior or specify the
[cmake]   DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
[cmake]   robustness issue.
[cmake] Call Stack (most recent call first):
[cmake]   out/build/windows-msvc-debug-user-mode-user/_deps/_project_options-src/src/PackageProject.cmake:160 (FetchContent_Declare)
[cmake]   CMakeLists.txt:175 (package_project)
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.

I tried increasing the maximum version in my main CMakeLists.txt

cmake_minimum_required(VERSION 3.15...3.24)

but the warning kept showing. Running cmake with --trace showed that project_options calls again to cmake_minimum_required at Index.cmake which seems to override whatever the project declares. Removing that line the warning was no longer displayed.

I think it's better for the library to not call cmake_minimum_required itself given the above.

Could you make a pull request?