CMP0150.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. CMP0150
  2. -------
  3. .. versionadded:: 3.27
  4. :command:`ExternalProject_Add` and :command:`FetchContent_Declare` commands
  5. treat relative ``GIT_REPOSITORY`` paths as being relative to the parent
  6. project's remote.
  7. Earlier versions of these commands always treated relative paths in
  8. ``GIT_REPOSITORY`` as local paths, but the base directory it was treated
  9. as relative to was both undocumented and unintuitive. The ``OLD`` behavior
  10. for this policy is to interpret relative paths used for ``GIT_REPOSITORY``
  11. as local paths relative to the following:
  12. * The parent directory of ``SOURCE_DIR`` for :command:`ExternalProject_Add`.
  13. * ``FETCHCONTENT_BASE_DIR`` for :command:`FetchContent_Declare`.
  14. The ``NEW`` behavior is to determine the remote from the parent project and
  15. interpret the path relative to that remote. The value of
  16. :variable:`CMAKE_CURRENT_SOURCE_DIR` when :command:`ExternalProject_Add` or
  17. :command:`FetchContent_Declare` is called determines the parent project.
  18. The remote is selected according to the following (the first match is used):
  19. * If the parent project is checked out on a branch with an upstream remote
  20. defined, use that remote.
  21. * If only one remote is defined, use that remote.
  22. * If multiple remotes are defined and one of them is named ``origin``, use
  23. ``origin``'s remote but also issue a warning.
  24. If an appropriate remote cannot be determined from the above, a fatal error
  25. will be raised.
  26. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.27
  27. .. |WARNS_OR_DOES_NOT_WARN| replace::
  28. warns when a relative path is encountered
  29. .. include:: include/STANDARD_ADVICE.rst
  30. .. include:: include/DEPRECATED.rst