File: CMP0150.rst

package info (click to toggle)
cmake 4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 152,348 kB
  • sloc: ansic: 403,894; cpp: 303,807; sh: 4,097; python: 3,582; yacc: 3,106; lex: 1,279; f90: 538; asm: 471; lisp: 375; cs: 270; java: 266; fortran: 239; objc: 215; perl: 213; xml: 198; makefile: 108; javascript: 83; pascal: 63; tcl: 55; php: 25; ruby: 22
file content (39 lines) | stat: -rw-r--r-- 1,626 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
CMP0150
-------

.. versionadded:: 3.27

:command:`ExternalProject_Add` and :command:`FetchContent_Declare` commands
treat relative ``GIT_REPOSITORY`` paths as being relative to the parent
project's remote.

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 ``OLD`` behavior
for this policy is to interpret relative paths used for ``GIT_REPOSITORY``
as local paths relative to the following:

* The parent directory of ``SOURCE_DIR`` for :command:`ExternalProject_Add`.
* ``FETCHCONTENT_BASE_DIR`` for :command:`FetchContent_Declare`.

The ``NEW`` behavior is to determine the remote from the parent project and
interpret the path relative to that remote.  The value of
:variable:`CMAKE_CURRENT_SOURCE_DIR` when :command:`ExternalProject_Add` or
:command:`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``, use
  ``origin``'s remote but also issue a warning.

If an appropriate remote cannot be determined from the above, a fatal error
will be raised.

.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.27
.. |WARNS_OR_DOES_NOT_WARN| replace::
   warns when a relative path is encountered
.. include:: include/STANDARD_ADVICE.rst

.. include:: include/DEPRECATED.rst