mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 13:30:39 +00:00
CMakeFindDependencyMacro: Document return() behavior and caveats
The `find_dependency` macro is designed to be called from Package Configuration Files, not from Find Modules. The return() behavior is particularly problematic for find modules. Document this more clearly. Issue: #17257
This commit is contained in:
parent
07a05079d3
commit
e48acfc501
@ -5,18 +5,29 @@
|
|||||||
CMakeFindDependencyMacro
|
CMakeFindDependencyMacro
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
::
|
.. command:: find_dependency
|
||||||
|
|
||||||
|
The ``find_dependency()`` macro wraps a :command:`find_package` call for
|
||||||
|
a package dependency::
|
||||||
|
|
||||||
find_dependency(<dep> [...])
|
find_dependency(<dep> [...])
|
||||||
|
|
||||||
|
It is designed to be used in a
|
||||||
|
:ref:`Package Configuration File <Config File Packages>`
|
||||||
|
(``<package>Config.cmake``). ``find_dependency`` forwards the correct
|
||||||
|
parameters for ``QUIET`` and ``REQUIRED`` which were passed to
|
||||||
|
the original :command:`find_package` call. Any additional arguments
|
||||||
|
specified are forwarded to :command:`find_package`.
|
||||||
|
|
||||||
``find_dependency()`` wraps a :command:`find_package` call for a package
|
If the dependency could not be found it sets an informative diagnostic
|
||||||
dependency. It is designed to be used in a <package>Config.cmake file, and it
|
message and calls :command:`return` to end processing of the calling
|
||||||
forwards the correct parameters for QUIET and REQUIRED which were passed to
|
package configuration file and return to the :command:`find_package`
|
||||||
the original :command:`find_package` call. It also sets an informative
|
command that loaded it.
|
||||||
diagnostic message if the dependency could not be found.
|
|
||||||
|
|
||||||
Any additional arguments specified are forwarded to :command:`find_package`.
|
.. note::
|
||||||
|
|
||||||
|
The call to :command:`return` makes this macro unsuitable to call
|
||||||
|
from :ref:`Find Modules`.
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
macro(find_dependency dep)
|
macro(find_dependency dep)
|
||||||
|
Loading…
Reference in New Issue
Block a user