Page MenuHomePhabricator

[CMake] Explicitly set CMP0116 policy
Needs ReviewPublic

Authored by Kayjukh on Mar 30 2021, 1:04 PM.

Details

Summary

CMake 3.20.0 introduces a new policy that allows us to specify the
behavior of the DEPFILE argument to add_custom_command() for Ninja
builds. Setting this policy to OLD makes DEPFILE be either an absolute
path or a path relative to CMAKE_BINARY_DIR. In contrast, the NEW
behavior makes the path absolute or relative to CMAKE_CURRENT_BINARY_DIR.

CMake only emits a warning because DEPFILE is used in a subdirectory. If
it were not, the build would default to the OLD behavior. Explicitly set
the policy to OLD to silence this warning for Ninja builds.

Additional information: cmake --help-policy CMP0116

Diff Detail

Event Timeline

Kayjukh created this revision.Mar 30 2021, 1:04 PM
Kayjukh requested review of this revision.Mar 30 2021, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2021, 1:04 PM
Kayjukh updated this revision to Diff 334260.Mar 30 2021, 1:22 PM

Check for the CMake version before setting the policy. Unknown policies cause errors during the CMake configuration phase.