Skip to content

Set target policy version instead of just minumum#53

Merged
AJenbo merged 1 commit into
mainfrom
cmake-policy
Jul 6, 2025
Merged

Set target policy version instead of just minumum#53
AJenbo merged 1 commit into
mainfrom
cmake-policy

Conversation

@ephphatha
Copy link
Copy Markdown
Contributor

Should allow building the cpp component with modern cmakes while not requiring us to set policies individually to avoid warnings (...mostly)

Removed the cmp0077 policy because this appeared to be set only for nholmon::json, but that project contains a conditional block that sets the policy to new if the policy version is higher than 3.13 anyway. We were already using that since the min version is 3.14

fixes #50

Somewhat related, I'm still getting the following warning because I'm using cmake3.30+:

[cmake] CMake Warning (dev) at /usr/share/cmake-3.31/Modules/FetchContent.cmake:1953 (message):
[cmake]   Calling FetchContent_Populate(libzt) is deprecated, call
[cmake]   FetchContent_MakeAvailable(libzt) instead.  Policy CMP0169 can be set to
[cmake]   OLD to allow FetchContent_Populate(libzt) to be called directly for now,
[cmake]   but the ability to call it with declared details will be removed completely
[cmake]   in a future version.
[cmake] Call Stack (most recent call first):
[cmake]   CMake/functions/FetchContent_MakeAvailableExcludeFromAll.cmake:7 (FetchContent_Populate)
[cmake]   3rdParty/libzt/CMakeLists.txt:10 (FetchContent_MakeAvailableExcludeFromAll)
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.

I think fixing this would require bumping the minimum version to 3.28 and replacing our custom function with the new options added to FetchContent_Declare/FetchContent_MakeAvailable():

Added in version 3.28: If the EXCLUDE_FROM_ALL keyword was included in the call to FetchContent_Declare(), the EXCLUDE_FROM_ALL keyword will be added to the add_subdirectory() command.

Should allow building the cpp component with modern cmakes while not requiring us to set policies individually to avoid warnings (...mostly)
@AJenbo AJenbo merged commit 919cead into main Jul 6, 2025
4 checks passed
@AJenbo
Copy link
Copy Markdown
Member

AJenbo commented Jul 6, 2025

Thanks

@AJenbo AJenbo deleted the cmake-policy branch July 6, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CMake Warning: DOWNLOAD_EXTRACT_TIMESTAMP not set, causing policy CMP0135

2 participants