1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Files
CMake/Help/variable/CMAKE_FIND_PACKAGE_WARN_NO_MODULE.rst
Cristian Adam 26a99da206 find_package: Add option to prefer Config mode
Add a `CMAKE_FIND_PACKAGE_PREFER_CONFIG` variable to tell
`find_package` calls to look for a package configuration file
first even if a find module is available.

Fixes: #16805, #19236
2019-05-21 10:29:47 -04:00

23 lines
1.1 KiB
ReStructuredText

CMAKE_FIND_PACKAGE_WARN_NO_MODULE
---------------------------------
Tell :command:`find_package` to warn if called without an explicit mode.
If :command:`find_package` is called without an explicit mode option
(``MODULE``, ``CONFIG``, or ``NO_MODULE``) and no ``Find<pkg>.cmake`` module
is in :variable:`CMAKE_MODULE_PATH` then CMake implicitly assumes that the
caller intends to search for a package configuration file. If no package
configuration file is found then the wording of the failure message
must account for both the case that the package is really missing and
the case that the project has a bug and failed to provide the intended
Find module. If instead the caller specifies an explicit mode option
then the failure message can be more specific.
Set ``CMAKE_FIND_PACKAGE_WARN_NO_MODULE`` to ``TRUE`` to tell
:command:`find_package` to warn when it implicitly assumes Config mode. This
helps developers enforce use of an explicit mode in all calls to
:command:`find_package` within a project.
This variable has no effect if :variable:`CMAKE_FIND_PACKAGE_PREFER_CONFIG` is
set to ``TRUE``.