When a dependency was already found, find_dependency did not search it
again. While this works in basic case, it does not when there are
components as the check does not take components into account.
Given the fact that there is no documentation about this optimization and
that the correct implementation is not trivial as it would require
changes in find_package to have the list of components already found we
always search dependencies.
Fix#17583.
The variable is unused since commit ab358d6a85 (Improve find_dependency
argument handling, 2017-05-22, v3.9.0-rc1~57^2) where handling of EXACT
keyword in find_dependency was reworked.
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
Remove highly specialized and totally positional argument handling in
find_dependency macro, and instead just pass arguments through to
find_package. This gives users access to the full suite of arguments
that find_package knows, and is backward compatible with the old
arguments.
Also, rewrite the unit tests for this, since the old tests are
exclusively focused on testing the old argument handling and are no
longer applicable, and add some success tests (the old tests did not
even set up the CMake state in a way that CMake had any hope of ever
finding the test package).
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool. Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience. Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.
Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices. It also references version control
history for more precise information. Therefore we no longer need to spell
out the list of Contributors in each source file notice.
Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing". The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.
Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically. Manually fix up shebang lines and trailing
newlines in a few files. Manually update the notices in a few files that the
script does not handle.
Test the first argument directly for matching 'EXACT'. The error
check in its previous position was incorrect and would only trigger
with a version of '0' or similar.
If a package is requested with an EXACT version, that doesn't imply
that dependencies must be found EXACTly too.
Extend the macro to allow specifying that a dependency must be found
by EXACT version instead.
If there is no ARGV1, that is fine; version will be made empty, and no
version will be passed to find_package().
This is relevant when find_dependency is invoked multiple times,
sometimes with a version specified and sometimes without.
find_dependency(dep1 3.4)
find_dependency(dep2) # version still set to 3.4.
Set a global property in the find_package implementation. Track and
reset that property in the find_dependency macro. Read the property
in FeatureSummary when determining whether to print output.
This means that packages which are found only as dependencies are not
listed by FeatureSummary, but if a project uses find_package elsewhere
directly, then it will be listed by FeatureSummary.
Suggested-by: Alex Merry
http://thread.gmane.org/gmane.comp.kde.devel.frameworks/10640