The find_package command, on Windows, has always searched build trees
recently visited by cmake-gui (or CMakeSetup at one time). This was
done when the command was created with the intention of simplifying
workflows involving building multiple dependent projects. However,
this behavior depends on recent developer interaction and therefore
can create different find results based on transient system states.
It can lead to surprising results and user confusion.
Since this behavior was first added CMake has gained many more search
options, better error messages when a package is not found, and a
package registry. The latter in particular allows projects to make
their build trees available for dependent projects to find without
user intervention. Therefore the originally intended workflow can
be achieved in other, more stable ways.
After the above evoluion of find_package we have now decided that
the magic search-where-cmake-gui-was behavior does more harm than
good. Drop it. We do not need a policy for this behavior change
because it only affects interactive use.
When a project is packaged for redistribution the local package
registries should not be updated or consulted. They are for developers.
Add variables to disable use of package registries globally:
* CMAKE_EXPORT_NO_PACKAGE_REGISTRY that disables the export(PACKAGE)
command
* CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY that disables the User Package
Registry in all the find_package calls.
* CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY that disables the
System Package Registry in all the find_package calls.
Update documentation and unit tests.
Recently used cmake-gui locations are searched only on Windows because
the Windows registry is used to record the values. This behavior is
historical and may be removed by a policy in the future so rather than
implementing it on other platforms simply document the current behavior.
These documents were represented in the builtin documentation using a
common starting point with placeholders substituted by each command.
Convert them back to this approach using the reStructuredText include
directive and substitutions to avoid duplication.