Commit Graph

64 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
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
Nikita Nemkin
9890cfc4ec Help: More syntax highlighting for literal blocks
Covers almost all blocks containing actual code, except:

* Parsed-literal blocks can't be highlighted, including many command
  summaries and substitution-heavy docs like find_... commands.
  This is a Sphinx limitation.

* Code with errors, like CMP0049, DEPLOYMENT_ADDITIONAL_FILES,
  DEPLOYMENT_REMOTE_DIRECTORY, @PACKAGE_INIT@ substitution in the
  tutorial, bracket arguments/comments in cmake-language.7 and
  cmake-developer.7.

* FindQt4 module, which needs reformatting.
2025-01-29 16:48:53 -05:00
Raul Metsma
2785364b7b iOS: Add support for Mac Catalyst
Issue: #20132
Signed-off-by: Raul Metsma <raul@metsma.ee>
2024-07-03 11:15:45 -04:00
Craig Scott
41f4e1c457 CMakePackageConfigHelpers: Document PACKAGE_PREFIX_DIR for public use
This variable has long been provided by `configure_package_config_file`
in the `@PACKAGE_INIT@` part of the package configuration file it
generates.  Although not publicly documented, projects have come to
use it.  Now that we preserve the value across nested `find_package`
calls, it has a stable meaning.

Issue: #25827
2024-04-20 10:05:40 +10:00
Craig Scott
bf88879f1f generate_apple_architecture_selection_file: Avoid early returns
This refactoring makes the generated file follow the same structure as
generate_apple_platform_selection_file(). It uses a single if-elseif-else-endif
block rather than a sequence of if-endif blocks. This avoids any early
return() calls, allowing cleanup code to be added at the end later.
2024-04-19 18:17:19 +10:00
Craig Scott
a4ac2c92f4 Help: Add missing section heading for apple architecture selection 2024-04-19 18:17:19 +10:00
Craig Scott
b7fcc44be9 Help: Fix CMakePackageConfigHelpers typos, grammar and formatting 2024-04-19 18:17:19 +10:00
Brad King
0e4db17764 CMakePackageConfigHelpers: Restore undocumented PACKAGE_PREFIX_DIR variable
Revert commit 6ddf8712cd (CMakePackageConfigHelpers: Use unique variable
name for pkg prefix, 2024-03-30, v3.29.1~8^2).  It regressed existing
projects that rely on the undocumented `PACKAGE_PREFIX_DIR` variable in
package configuration files generated by `CMakePackageConfigHelpers`.

Fixes: #25873
Fixes: #25885
Issue: #25827
2024-04-11 09:23:46 -04:00
Craig Scott
6ddf8712cd CMakePackageConfigHelpers: Use unique variable name for pkg prefix
Fixes: #25827
2024-04-01 09:32:37 +11:00
Craig Scott
91b9d35608 CMakePackageConfigHelpers: Remove unused variable 2024-04-01 09:32:28 +11:00
Brad King
85d6d3b2e3 generate_apple_*_selection_file: Add option to capture errors
Add an option to capture error messages in a variable instead of
terminating with a fatal error.

Fixes: #25778
2024-03-19 09:52:32 -04:00
Brad King
2149dbd379 generate_apple_architecture_selection_file: Document $(ARCHS_STANDARD) support
Also add a test case.

Fixes: #25780
2024-03-19 09:52:32 -04:00
Brad King
be642f6ed5 generate_apple_architecture_selection_file: Simplify signature
Allow callers to pass multiple values to list-valued arguments
instead of putting the entire list in a single quoted argument.

Fixes: #25779
2024-03-19 09:52:32 -04:00
Brad King
2a398cd9b6 CMakePackageConfigHelpers: Clarify generate_apple_*_selection_file signatures
The helpers added by:

* commit 37bc3400cd (CMakePackageConfigHelpers: Add
                     generate_apple_platform_selection_file(), 2023-11-03)
* commit 4ac5a2f866 (CMakePackageConfigHelpers: Add
                     generate_apple_architecture_selection_file(), 2023-12-19)

were worded in terms of including package configuration files, but the
actual functionality is to include files *from* package configuration
files.  The included files do not themselves need to be usable as
package configuration files.

Rename the options and clarify the documentation accordingly.

Issue: #25262
Issue: #25516
2024-01-04 19:01:35 -05:00
Brad King
4ac5a2f866 CMakePackageConfigHelpers: Add generate_apple_architecture_selection_file()
Add a helper to select architecture-specific implementations of a
package on an Apple-specific platform.

Fixes: #25516
2023-12-19 08:56:30 -05:00
Brad King
b9f81ee9f9 CMakePackageConfigHelpers: Remove outdated documentation summary paragraph 2023-12-19 08:56:11 -05:00
Brad King
68a03cf3d4 generate_apple_platform_selection_file: Add INSTALL_PREFIX option
This is necessary to forward to `configure_package_config_file`.
2023-12-19 08:51:16 -05:00
Brad King
d2cbadf3b4 Merge topic 'package-dispatch-apple'
dc5098429b CMakePackageConfigHelpers: Clarify Apple platform selection usage error
3b9586671c CMakePackageConfigHelpers: Clarify Apple platform selection template name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9087
2023-12-19 08:10:15 -05:00
Brad King
1a6303aa8c CMakePackageConfigHelpers: Fix generate_apple_platform_selection_file docs
Previously the documentation was not rendered correctly.
2023-12-18 16:35:46 -05:00
Brad King
dc5098429b CMakePackageConfigHelpers: Clarify Apple platform selection usage error
`generate_apple_platform_selection_file` requires `INSTALL_DESTINATION`.
2023-12-18 14:57:27 -05:00
Brad King
3b9586671c CMakePackageConfigHelpers: Clarify Apple platform selection template name
The template added by commit 37bc3400cd (CMakePackageConfigHelpers: Add
generate_apple_platform_selection_file(), 2023-11-03) is specific to
Apple platforms.  Give it an Apple-specific name.
2023-12-18 14:28:34 -05:00
Brad King
f23636617a CMakePackageConfigHelpers: Move platform selection template to Internal/
The template added by commit 37bc3400cd (CMakePackageConfigHelpers: Add
generate_apple_platform_selection_file(), 2023-11-03) is a private
implementation detail.  Move it to `Modules/Internal/`.
2023-12-07 16:54:09 -05:00
Kyle Edwards
37bc3400cd CMakePackageConfigHelpers: Add generate_apple_platform_selection_file()
Issue: #25262
2023-11-15 09:10:58 -05:00
Brad King
04b0d5c862 codespell: Fix typos 2023-05-22 16:51:15 -04:00
FeRD (Frank Dana)
bfa61ccf64 Help: Modernize PackageConfigHelpers example
The example shown in the module documentation for
CMakePackageConfigHelpers was showing its age, by:

1. Hardcoding directory prefixes (`etc/`, `lib/`, etc.) instead of
   using GNUInstallDirs
2. Handwaving `set()` commands (incorrectly!) as:
     `set(VAR dir/ ... CACHE )`
   which should, at the very least, be:
     `set(VAR dir/ CACHE ... )`
3. Installing CMake configuration files to `lib/Foo/cmake/`, when
   current practice favors `${CMAKE_INSTALL_LIBDIR}/cmake/Foo/`

This updated example addresses all of those issues.
2023-01-23 18:02:31 -05:00
friendlyanon
a82163839a CMakePackageConfigHelpers: Fix note about version files supporting ranges
In commit 55c3b6a77e (CMakePackageConfigHelpers: Relax restrictions on
version range, 2019-05-30, v3.20.0-rc1~295^2~1) the documentation for
write_basic_package_version_file documented the support of version
ranges by the generated version files, however the note wrongly
specifies a COMPATIBILITY_MODE argument, instead of COMPATIBILITY.
2022-05-11 14:00:38 -04:00
Josef Angstenberger
15cc39ed7f Modules: Fix typos and spelling in documentation 2021-05-07 17:00:16 +02:00
Marc Chevrier
55c3b6a77e CMakePackageConfigHelpers: Relax restrictions on version range 2020-12-15 09:24:09 +11:00
Nikita Nemkin
8fea95319b Help: Add .. versionadded directives to module docs
Issue: #19715
2020-12-02 21:00:30 +05:00
Craig Scott
95c14579f2 Help: Cleanup typos and grammar for the 3.19 release 2020-10-24 22:58:42 +11:00
Marc Chevrier
5b3356263c CMakePackageConfigHelpers: Add version range support 2020-09-23 12:52:25 +02:00
Justin Bassett
eb973f935f CMakePackageConfigHelpers: Add ARCH_INDEPENDENT option
Allow skipping the architecture check in the package version file generated from calling
write_basic_package_version_file. Document said architecture check.

Fixes: #16184
2018-11-30 22:52:40 -08:00
Kitware Robot
df4ed1e9ff Help: Convert remaining modules to block-style comments 2018-10-22 11:09:34 -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
Ruslan Baratov
aeda8fcceb Help: Package without components should use 'check_required_components' too
Macro 'check_required_components' should be called even if there are no
components provided by package.  This will make sure error is reported
in next cases:

    find_package(Foo CONFIG REQUIRED oops) # 'oops' treated as component
    find_package(Foo CONFIG REQUIRED COMPONENTS foo) # no components expected
2018-06-07 10:41:45 -04:00
Daniele E. Domenichelli
16a93de0a8 WriteBasicConfigVersionFile: Add SameMinorVersion COMPATIBILITY option 2017-11-21 09:27:07 +01:00
luzpaz
777e87ae00 Fix trivial typos in text
Some are user facing.

Found using

    codespell -q 3 --skip="./Utilities" -I .cmake-whitelist.txt`

whereby the whitelist contained:

    ans
    dum
    helpfull
    emmited
    emmitted
    buil
    iff
    isnt
    nto
    ot
    pathes
    substract
    te
    todays
    upto
    whitespaces
2017-11-03 10:25:05 -04:00
Brad King
30abf145fd Help: Fix cmake code block warnings produced by Sphinx 1.4
Some of our "cmake" code blocks do not use fully valid CMake syntax
because they have placeholders for human reference.  Sphinx has
never been able to properly lex and highlight these, but now warns.
Fix each block's syntax or change to a non-cmake block as appropriate.
2017-02-10 10:43:30 -05: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
Sergiu Deitsch
fd31feb03f CMakePackageConfigHelpers: allow to specify a relative CMAKE_INSTALL_PREFIX 2016-03-22 14:30:01 -04: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
Daniele E. Domenichelli
d057bf85a6 CMakePackageConfigHelpers: Add INSTALL_PREFIX option
This option instructs configure_package_config_file to consider paths
that are not absolute as relative to the INSTALL_PREFIX directory
instead of relative to the CMAKE_INSTALL_PREFIX directory.

If this argument is not passed, the default behaviour is to use
the CMAKE_INSTALL_PREFIX variable.

The new signature is therefore:

  configure_package_config_file(<input> <output> INSTALL_DESTINATION <path>
                                                 [PATH_VARS <var1> <var2> ... <varN>]
                                                 [NO_SET_AND_CHECK_MACRO]
                                                 [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
                                                 [INSTALL_PREFIX <path>])
2014-08-11 09:38:29 -04:00
Daniele E. Domenichelli
f3dd116cee CMakePackageConfigHelpers: restructure documentation and document commands 2014-08-11 09:38:29 -04:00
Daniele E. Domenichelli
64eca30dc4 CMakePackageConfigHelpers: Remove unused variable 2014-08-04 10:07:16 -04:00
Alex Neundorf
41d2f2c4cb write_basic_package_version_file: use PROJECT_VERSION
In the write_basic_package_version_file(), the VERSION argument
is now optional. If none is given, it falls back to ${PROJECT_VERSION}.

Alex
2014-01-29 09:45:18 -05:00
Stephen Kelly
a1d2bda23e Don't copy find_dependency in configure_package_config_file.
There is not really any need to. Downstreams can either rely on it
being provided by CMake, or copy and distribute it.

Change the documented include for the find_dependency macro.
2013-12-24 13:02:49 +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