Commit Graph

76 Commits

Author SHA1 Message Date
Peter Kokot
1d0b46111e Help: Add remaining intro code blocks to modules
This is a follow-up to add intro code blocks to all remaining utility
and find modules.

Fixes: #26555
2025-08-18 11:52:56 +02:00
Peter Kokot
ea298035ba FindPackageHandleStandardArgs: Update documentation
- Used "commands" instead of "functions".
- Added separate examples section.
- Moved FOUND_VAR argument to the bottom as it is deprecated.
- Reworded descriptions.
2025-08-08 23:49:59 +02:00
Peter Kokot
ee398e8946 FindPackageMessage: Update documentation
- Documentation updated.
- This module is internally already used by the
  FindPackageHandleStandardArgs module and can conflict when used again
  in the find module due to the same <PackageName> used, or when QUIET
  option is used. For this reason, the example is changed and explained
  at the bottom to use find_package_handle_standard_args().
- Lower-case style function used in FindPackageHandleStandardArgs.
2025-03-08 22:50:11 +01:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Brad King
c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Brad King
98a59ba8ad CMP0012: Remove support for OLD behavior 2025-01-17 09:28:36 -05:00
Brad King
f875830868 Merge topic 'patch-script-mode'
b8067f1967 FPHSA: Hide hint message when running CMake in script mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10144
2025-01-09 10:48:24 -05:00
Peter Kokot
b8067f1967 FPHSA: Hide hint message when running CMake in script mode
Issue: #25941
2025-01-06 06:06:25 +01:00
Peter Kokot
1a8e43d57d FindPackageHandleStandardArgs: Clarify the FOUND_VAR option
The `find_package_handle_standard_args(FOUND_VAR)` is deprecated as of
CMake 3.3 and both the `<PackageName>_FOUND` and the upper-cased
`<PACKAGE_NAME>_FOUND` are set with or without using this option.
Additionally, find modules and docs are also synced with this to make it
clearer.
2024-12-31 02:07:16 +01:00
Alex Turbov
a67df19d82 FPHSA: Consistent quoting in reported messages
Command names are not enclosed into quotes/backticks and have `()`
at the end. Named arguments (keywords) have no quotes as well.
2024-11-26 23:40:01 +04:00
Alex Turbov
440d4446f5 FPHSA: Consistent character case when mentioning the command name 2024-11-26 19:58:25 +04:00
Alex Turbov
998d5b1ad0 FPHSA: Consistent style for CMake command calls
No space after a command name and before `()`!
2024-11-26 19:58:18 +04:00
Alex Turbov
c1d49b3f3c FPHSA: Refactor to use ZIP_LISTS 2024-11-26 19:58:14 +04:00
Alex Turbov
11bf70f968 FindPackageHandleStandardArgs: Remove the unneeded symbol from the message 2024-11-19 17:57:27 +04:00
Brad King
68a8c89430 FPHSA: Add hint for failure when called before project()
Help project authors recognize an ordering mistake.

Inspired-by: Jeremy Rifkin @jeremy-rifkin
Closes: #25941
2024-05-01 11:25:28 -04:00
Niklas Weissner
2fc22a3dec FPHSA: Fix empty version message in exact match
`find_package_check_version()` would use variable `_FOUND_VERSION` set
by `find_package_handle_standard_args()` in a single branch when doing
exact matching, causing empty version messages if it was instead called
directly.

This was missed in commit 6bfc442fde (FPHSA: add support of version
range, 2020-09-22, v3.19.0-rc1~122^2~1) when the version check was moved
into its own function.
2024-02-07 10:43:44 -05:00
Brad King
07f0a78874 FPHSA: Fix regression when VERSION_VAR is missing
If a package is found but FPHSA is called by the find module without a
`VERSION_VAR`, and the `find_package` call specifies a version, we have
previously accepted the package as found.  This was accidentally
regressed by commit 8f50f135ae (FPHSA: Improve error message when
VERSION_VAR is empty or has been unset(), 2022-08-01).  Restore it and
add a test case.
2022-09-15 11:00:02 -04:00
Andrea Pappacoda
8f50f135ae FPHSA: Improve error message when VERSION_VAR is empty or has been unset()
Previously, when `VERSION_VAR` is set but empty, FPHSA emitted a
confusing error message, saying that the package was found but of an
unsuitable version "".  Fix the error message to state that the package
was not found.

Fixes: #23807
2022-09-07 10:11:06 -04:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Marc Chevrier
14ecf9c2f6 FPHSA: ensure it can be used outside 'find_package'
Fixes: #21505
2020-11-25 16:36:12 +01:00
Marc Chevrier
212b0afb66 find_package: raise error on empty version range 2020-09-29 13:06:09 +02:00
Marc Chevrier
1e82b1c4bc FPHSA: avoid spurious error if version variable is not defined
Fixes: #21241
2020-09-25 19:35:11 +02:00
Marc Chevier
6bfc442fde FPHSA: add support of version range 2020-09-23 12:52:25 +02:00
Marc Chevrier
0b6332af60 FPHSA: REQUIRED_VARS is optional if HANDLE_COMPONENTS is specified
Fixes: #20655
2020-04-30 10:54:36 +02:00
FeRD (Frank Dana)
31144f85af FPHSA: Check _FOUND var name with STREQUAL
Using MATCHES "^${_Name}_FOUND$" limits the name of the found variable,
since it can't contain any regular expression special-chars (period,
plus sign, etc.)
2020-01-23 20:26:05 -05:00
Ben Boeckel
ee4673c1ae FPHSA: detect package name mismatches
The `FPHSA_NAME_MISMATCHED` variable may be set if this is intentional
(but should be cleared after the call to not affect other FPHSA calls).
It may also be passed via the `NAME_MISMATCHED` option for new-signature
FPHSA calls.
2020-01-14 17:25:49 -05:00
Marc Chevrier
60473cc660 FPHSA: add capability to specify message explaining reason of failure
Fixes: #19660
2019-09-27 16:04:54 +02:00
Sylvain Joubert
e45187d525 FPHSA: Remove extra space in module components report 2019-08-06 12:42:06 +02: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
Yves Frederix
a8f70b32fb FPHSA: replace left-over VERSION by _FOUND_VERSION.
This was accidentally left out of commit aec27c152e (FPHSA: use more
localized _FOUND_VERSION instead of VERSION, 2017-09-05).

Fixes: #17281
2017-09-14 08:21:38 -04:00
Yves Frederix
91935d9e54 FPHSA: lower-case for cmake_parse_arguments + move config-mode related code 2017-09-05 21:20:04 +02:00
Yves Frederix
aec27c152e FPHSA: use more localized _FOUND_VERSION instead of VERSION.
This fixes the failing unit tests in which a cache variable VERSION is present or the found version is 0.
2017-09-05 21:20:02 +02:00
Ben Boeckel
3c515e1922 FPHSA: remove extra space
Each missing variable is added to the string as " ${var}" which causes
the string to always have a leading space. Remove the duplicate space
due to this in the output.
2017-05-15 09:23:29 -04:00
Daniel Pfeifer
d6877e6c40 Don't include CMakeParseArguments
The cmake_parse_arguments command is builtin with version 3.5.
The CMakeParseArguments module is empty and exists for backwards
compatibility with CMake 3.4 and lower.

Remove the includes of CMakeParseArguments from CMake's modules.
The modules are always used with the current version of CMake.

Leave the includes in the tests, as the tests may be run with an older
version of CMake.
2017-01-11 13:14:57 +01: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
Daniel Pfeifer
5d0d980d99 Use string(APPEND) in Modules
Automate with:

find Modules -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2016-07-28 00:41:13 +02:00
Rolf Eike Beer
64e527dbe3 FPHSA: fix typo in documentation 2015-08-24 18:22:13 +02:00
Brad King
84f06d0c84 FPHSA: Document REQUIRED_VARS recommendation (#15352)
State explicitly that the variables specified are user-facing.
2015-04-17 10:46:25 -04:00
Brad King
a3ad275ce0 FPHSA: Revise and format documentation
Use better reStructuredText markup and add cross-references.
2015-04-17 10:46:24 -04:00
Stephen Kelly
d1a6d15bcd FPHSA: Always populate the ExactCase_FOUND variable (#15412).
The UPPERCASE name was inconsistent with config-packages, the
find_dependency macro, and even FPHSA itself, which expects
components to be specified with names matching ExactCase.

The FOUND_VAR was only permitted to have two possible values, and
now both are set for compatibility.  Document it as obsolete, and
adjust the code for the same.  Users of the variable should just
remove it.
2015-04-17 10:46:24 -04:00
Gregor Jasny
394514135e FPHSA: Revise documented command signature
For mode 2 the first argument is not the literal NAME
but the package name.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-03-18 15:15:44 +01:00
Rolf Eike Beer
22362c65e1 FPHSA: remove unneeded variable dereferencing
These variables can be dereferenced by if() alone so do not do it here, avoiding
the risk of their content being treated as a variable name and dereferenced
again.
2014-10-25 19:33:38 +02:00
Brad King
58b2d760ee Modules: Format documentation to avoid over-long preformatted lines
Convert several preformatted code block literals that enumerate lists of
options or variables to use reST definition lists instead.  Manually
wrap other long lines in code blocks.
2014-10-22 15:52:31 -04:00
Rolf Eike Beer
ba907f7dc2 FPHSA: fix when requested or found version is exactly 0
Until now it was checked with "if(VAR)", which will be false in case "0" is the
content of the variable.
2014-10-07 23:14:46 +02:00
Rolf Eike Beer
4f9bf4468b FPHSA: when EXACT version match is requested only compare the components given
Given that you have a foobar that identifies itself as 1.2.3 from now on a

  find_package(foobar 1.2 EXACT)

will succeed, as 1.2.3 will now be considered as being 1.2. Until now this was
only the case for version 1.2.0.
2014-10-07 23:14:45 +02:00
Brad King
e177e7affb FPHSA: Avoid if() dereferencing of quoted variable
Legacy invocations may pass a variable name where "DEFAULT_MSG" belongs.
When comparing FPHSA_FAIL_MESSAGE to "DEFAULT_MSG", use a leading "x" on
both sides to avoid mistaking the value of the message for a variable
name.
2014-09-11 21:23:24 +02:00
Kitware Robot
f051814ed0 Convert builtin help to reStructuredText source files
Run the convert-help.bash script to convert documentation:

 ./convert-help.bash "/path/to/CMake-build/bin"

Then remove it.
2013-10-15 14:12:03 -04:00
Stephen Kelly
78e6217f31 FPHSA: Fix FOUND_VAR check to work with if() auto-dereference
Otherwise, it seems to match on the content of the variable.
2013-03-18 09:35:07 -04:00
Alex Neundorf
c1f5780e2d FPHSA: improve documentation
Alex
2013-02-22 08:32:34 -05:00
Alex Neundorf
7bb1abe56a FPHSA: Add FOUND_VAR option to specify _FOUND variable name
In the new mode FPHSA now accepts a FOUND_VAR option, which can be set
either to ExactCase_FOUND or UPPERCASE_FOUND, no other values are
accepted.  Also add tests for that, including failure.

Alex
2013-02-22 08:31:00 -05:00