New in version 3.27.
Earlier versions of these commands always treated relative paths in
GIT_REPOSITORY as local paths, but the base directory it was treated
as relative to was both undocumented and unintuitive. The
for this policy is to interpret relative paths used for
as local paths relative to the following:
The parent directory of
NEW behavior is to determine the remote from the parent project and
interpret the path relative to that remote. The value of
FetchContent_Declare() is called determines the parent project.
The remote is selected according to the following (the first match is used):
If the parent project is checked out on a branch with an upstream remote defined, use that remote.
If only one remote is defined, use that remote.
If multiple remotes are defined and one of them is named
origin's remote but also issue a warning.
If an appropriate remote cannot be determined from the above, a fatal error will be raised.
This policy was introduced in CMake version 3.27. CMake version 3.28.20231201-g3b8aaa1
warns when a relative path is encountered and the policy is not set,
falling back to using
OLD behavior. Use the
command to set it to
OLD behavior of a policy is
deprecated by definition
and may be removed in a future version of CMake.