Commit Graph

17 Commits

Author SHA1 Message Date
Damien R
37da6af17d find_dependency: Always search dependencies
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.
2019-03-29 22:03:21 +01:00
Damien R
82dec5191c find_dependency: Remove clearing of unused cmake_fd_exact_arg variable
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.
2019-03-26 11:56:02 -04:00
Jean-Christophe Fillion-Robin
30d08bdce9 doc: Consistently use <PackageName> for describing the name of a package 2018-08-14 20:54:56 +10:00
Brad King
e48acfc501 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
2017-09-08 10:44:45 -04:00
Brad King
07a05079d3 CMakeFindDependencyMacro: Convert documentation to bracket comment 2017-09-08 10:30:24 -04:00
Matthew Woehlke
ab358d6a85 Improve find_dependency argument handling
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).
2017-05-22 13:32:43 -04:00
Brad King
86578eccf2 Simplify CMake per-source license notices
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.
2016-09-27 15:14:44 -04:00
Aurélien Gâteau
34cd5fc451 find_dependency: Give more helpful message if VERSION is empty 2014-03-13 15:51:11 -04:00
Stephen Kelly
224f50f42f find_dependency: Make sure invalid EXACT use can be reported.
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.
2014-03-11 14:51:06 +01:00
Stephen Kelly
08ba128f51 find_dependency: Don't propagate EXACT argument.
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.
2014-03-06 15:07:37 +01:00
Alex Merry
3d8f7102bb find_dependency: unset cmake_fd_version variable at end of macro
This matches the other macro variables.
2014-02-26 10:27:01 -05:00
Alex Merry
85d0f8de7e find_dependency: use correct version variable name
The code set cmake_fd_version, but used ${version}.
2014-02-26 10:27:01 -05:00
Stephen Kelly
2be6dbe420 find_dependency: Ensure that ARGV1 has valid local content
The ARGV1 value could come from a wrapping context if find_dependency
is called from a function.
2014-02-24 19:00:42 +01:00
Stephen Kelly
a35ce7235b find_dependency: Add namespacing for variables in the macro.
Avoid setting a variable called 'version' etc.
2014-02-24 19:00:31 +01:00
Alex Merry
5878c5d919 Always set version variable of find_dependency macro
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.
2014-02-23 11:31:30 +01:00
Stephen Kelly
a6971f6510 FeatureSummary: Don't list transitive package dependencies
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
2014-02-03 20:20:42 +01:00
Stephen Kelly
20cafa2e1f Split the find_dependency macro into a separate file.
This allows Config file authors to use it without having to use
CONFIGURE_PACKAGE_CONFIG_FILE.
2013-12-13 16:14:02 +01:00