Skip to content

Help: Document more use cases for CMAKE_POLICY_DEFAULT_CMPNNNN

Brad King requested to merge brad.king/cmake:doc-policy-default into master

The documentation for this variable previously said it should not be set by project code so that users can set it as a cache entry instead. Generalize this explanation to mean that the project should not set its own policies with this variable, and that the purpose of the variable is to allow policies not set by the project to be controlled externally.

Policies CMP0077 and CMP00126 are particularly important when using add_subdirectory to add a third-party project. Suggest CMAKE_POLICY_DEFAULT_CMP{0077,0126} as a way to set the policies without modifying third-party code.

Issue: #20490 (closed)
Backport: release

Merge request reports