CMP0169.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. CMP0169
  2. -------
  3. .. versionadded:: 3.30
  4. Calling :command:`FetchContent_Populate` with a single argument (the name of
  5. a declared dependency) is deprecated.
  6. Prior to the introduction of :command:`FetchContent_MakeAvailable`, projects
  7. populated previously declared content (with :command:`FetchContent_Declare`)
  8. using the following pattern:
  9. .. code-block:: cmake
  10. FetchContent_GetProperties(depname)
  11. if(NOT depname_POPULATED)
  12. FetchContent_Populate(depname)
  13. add_subdirectory(${depname_SOURCE_DIR} ${depname_BINARY_DIR})
  14. endif()
  15. The above pattern does not support a number of features that have been added
  16. to :module:`FetchContent` over time. It ignores options like ``SYSTEM`` and
  17. ``EXCLUDE_FROM_ALL`` which may be given to :command:`FetchContent_Declare`,
  18. but can't be made known to the above project code. It also does not support
  19. :ref:`dependency providers <dependency_providers_overview>`.
  20. Projects should call :command:`FetchContent_MakeAvailable` instead of using
  21. the above pattern.
  22. CMake 3.30 and above prefers to reject calls to
  23. :command:`FetchContent_Populate` with the name of a declared dependency.
  24. This policy provides compatibility for projects that have not been updated
  25. to call :command:`FetchContent_MakeAvailable` instead.
  26. The ``OLD`` behavior of this policy allows :command:`FetchContent_Populate`
  27. to be called with the name of a declared dependency.
  28. The ``NEW`` behavior halts with a fatal error in such cases.
  29. .. note::
  30. Calling :command:`FetchContent_Populate` with the full population details
  31. as command arguments rather than just a dependency name remains fully
  32. supported. Only the form calling :command:`FetchContent_Populate` with a
  33. single argument (the name of a previously declared dependency) is deprecated
  34. with this policy.
  35. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
  36. .. |WARNS_OR_DOES_NOT_WARN| replace:: warns
  37. .. include:: include/STANDARD_ADVICE.rst
  38. .. include:: include/DEPRECATED.rst