Skip to content

ExternalProject/FetchContent: Support relative remote URLs

Teach ExternalProject_Add and FetchContent_Declare to resolve relative remote URLs provided via GIT_REPOSITORY:

  • When a branch has an upstream remote set, this is used regardless of the number of remotes available globally in the parent project.
  • If the branch remote can't be used (e.g. detached state), cmake will either:
    • use a single remote, regardless of the name,
    • or origin if multiple remotes are defined, issuing an error if multiple remotes are defined and none of them are called origin.

Add policy CMP0150 to maintain compatibility.

Fixes: #24211 (closed)
Topic-rename: ExternalProject-relative-git-urls

Edited by Brad King

Merge request reports