summaryrefslogtreecommitdiffstats
path: root/Help/policy/CMP0169.rst
blob: 38b8dcbb4d167c9f21c9897e6b026943d2776dc9 (plain)
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
40
41
42
43
44
45
46
47
48
49
CMP0169
-------

.. versionadded:: 3.30

Calling :command:`FetchContent_Populate` with a single argument (the name of
a declared dependency) is deprecated.

Prior to the introduction of :command:`FetchContent_MakeAvailable`, projects
populated previously declared content (with :command:`FetchContent_Declare`)
using the following pattern:

.. code-block:: cmake

  FetchContent_GetProperties(depname)
  if(NOT depname_POPULATED)
    FetchContent_Populate(depname)
    add_subdirectory(${depname_SOURCE_DIR} ${depname_BINARY_DIR})
  endif()

The above pattern does not support a number of features that have been added
to :module:`FetchContent` over time. It ignores options like ``SYSTEM`` and
``EXCLUDE_FROM_ALL`` which may be given to :command:`FetchContent_Declare`,
but can't be made known to the above project code. It also does not support
:ref:`dependency providers <dependency_providers_overview>`.
Projects should call :command:`FetchContent_MakeAvailable` instead of using
the above pattern.

CMake 3.30 and above prefers to reject calls to
:command:`FetchContent_Populate` with the name of a declared dependency.
This policy provides compatibility for projects that have not been updated
to call :command:`FetchContent_MakeAvailable` instead.

The ``OLD`` behavior of this policy allows :command:`FetchContent_Populate`
to be called with the name of a declared dependency.
The ``NEW`` behavior halts with a fatal error in such cases.

.. note::
  Calling :command:`FetchContent_Populate` with the full population details
  as command arguments rather than just a dependency name remains fully
  supported. Only the form calling :command:`FetchContent_Populate` with a
  single argument (the name of a previously declared dependency) is deprecated
  with this policy.

.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt

.. include:: DEPRECATED.txt