cmake/Help/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.rst

29 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
CMAKE_DISABLE_FIND_PACKAGE_<PackageName>
----------------------------------------
2015-11-17 17:22:37 +01:00
Variable for disabling :command:`find_package` calls.
2014-08-03 19:52:23 +02:00
2015-11-17 17:22:37 +01:00
Every non-``REQUIRED`` :command:`find_package` call in a project can be
disabled by setting the variable
``CMAKE_DISABLE_FIND_PACKAGE_<PackageName>`` to ``TRUE``.
2014-08-03 19:52:23 +02:00
This can be used to build a project without an optional package,
although that package is installed.
This switch should be used during the initial CMake run. Otherwise if
the package has already been found in a previous CMake run, the
variables which have been stored in the cache will still be there. In
that case it is recommended to remove the cache variables for this
2022-11-16 20:14:03 +01:00
package from the cache using the cache editor or :option:`cmake -U`.
2021-11-20 13:41:27 +01:00
2024-04-14 22:45:38 +02:00
Note that this variable can lead to inconsistent results within the project.
Consider the case where a dependency is requested via :command:`find_package`
from two different places within the project. If the first call does not
have the ``REQUIRED`` keyword, it will not find the dependency when
``CMAKE_DISABLE_FIND_PACKAGE_<PackageName>`` is set to true for that
dependency. The project will proceed under the assumption that the dependency
isn't available. If the second call elsewhere in the project *does* have the
``REQUIRED`` keyword, it can succeed. Two different parts of the same project
have then seen opposite results for the same dependency.
2021-11-20 13:41:27 +01:00
See also the :variable:`CMAKE_REQUIRE_FIND_PACKAGE_<PackageName>` variable.