137 Commits
Author SHA1 Message Date
Brad King a399d4c1ea Merge topic 'install-TARGETS-RUNTIME_DEPENDENCY_TARGETS'
53019cd2e6 install(TARGETS): Add option to install runtime deps built as other targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12483
2026-09-23 13:22:51 -04:00
Stepanov Igor 53019cd2e6 install(TARGETS): Add option to install runtime deps built as other targets
Add a `RUNTIME_DEPENDENCY_TARGETS` option for `install(TARGETS)`
to automatically install the necessary runtime shared libraries.

Closes: #23505
2026-09-22 10:40:52 -04:00
Matthew Woehlke 2673161b67 install: Improve documentation, argument parsing
Adjust documentation of `install(CODE|SCRIPT)` to more understandably
reflect how the subcommand actually operates. Adjust argument parsing of
the same to "accept" the `COMPONENT` argument being given more than
once, consistent with how single-valued arguments are usually parsed.
2026-09-11 12:22:25 -04:00
Tyler Yankee 7350b58c16 Help: Move regex specification to cmake-language(7)
Many other places in CMake beyond the `string` command rely on our
regex syntax, so it should be documented in a more general location.

Fixes: #22270
2026-09-07 10:17:42 -04:00
Brad King 1f40df769c Merge topic 'install-RUNTIME_DEPENDENCY_SET-note'
9057de7baf Help/install: Promote RUNTIME_DEPENDENCY_SET caveat to note

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12433
2026-08-25 09:34:09 -04:00
Tyler Yankee 9057de7baf Help/install: Promote RUNTIME_DEPENDENCY_SET caveat to note
Amends the documentation update in commit 24b76eaa93 (Help: Improve
readability and accuracy of runtime deps-related content, 2021-07-03,
v3.21.0-rc3~16^2).

Until a new feature is (potentially) implemented offering projects more
flexibility in this regard, the semantics around installation of
internal build-tree dependencies should be clarified, as it has caused
confusion on multiple occasions.

Issue: #28048
2026-08-24 11:26:39 -04:00
Tom Osika 8072e80f4b install(TARGETS): Add default destination for MODULE libraries
Installing a module target without a LIBRARY DESTINATION no longer
raises an error. On DLL platforms, the default destination is the
RUNTIME default. Otherwise, the LIBRARY default is used.

Closes: #27759
2026-08-13 10:55:07 -04:00
Tyler Yankee c707fde0f2 Help: Move general FILE_SET info to cmake-buildsystem(7)
File sets have evolved to be more ubiquitous throughout a CMake build,
outside the scope of simply the target_sources command. Move general
information to the `cmake-buildsystem(7)` manual and keep only
reference information specific to the syntax of target_sources in its
command page. Sprinkle some more cross-references to the new location.

Fixes: #27900

Suggested-By: Marc Chevrier <marc.chevrier@gmail.com>
2026-07-27 09:01:37 -04:00
Daniel Tierney b533f229b8 cmSbom: Generate SPDX data denoting project licenses 2026-06-15 14:40:26 -04:00
Tom Osika 273fc4cc49 SBOM: Support multi export set SBOMs 2026-06-01 12:27:13 -04:00
Matthew Woehlke 97d13c3053 Help: Improve diagnostics documentation
Make diagnostics into Sphinx objects so that they can be more readily
cross-referenced. (This is also needed to enable --help-diagnostic.)
Update various places that can make use of the same. Significantly
expand the documentation on controlling diagnostics.
2026-04-30 15:36:23 -04:00
Robert Maynard 39a56136a3 Diagnostic: Add warn or error on absolute install paths
Add `-Winstall-absolute-destination` diagnostic to warn or
error when an install command has an absolute destination.

This allow projects to enforce the best practice of not allowing
absolute install DESTINATIONS.
2026-04-29 09:22:29 -04:00
Marc Chevrier c386aaebf8 FILE_SET: install and export SOURCES file set type 2026-03-31 09:50:09 +02:00
Brad King 6bb0ec7d06 Merge topic 'patch-sbom-2'
d2aab1839e Help: Fix install(PACKAGE_INFO) and install(SBOM) argument typos

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11850
2026-03-23 10:33:32 -04:00
Peter Kokot d2aab1839e Help: Fix install(PACKAGE_INFO) and install(SBOM) argument typos
In commit 51f39a0f32 (Help: Fix install(SBOM) argument typo, 2026-02-27,
v4.3.0-rc2~8^2) the typo was fixed in the wrong signature.  Revert that
and fix the correct signature.
2026-03-23 09:45:17 -04:00
Peter Kokot 1ce6072907 install: Add module libraries to the list of artifact kind 2026-03-07 20:16:35 +01:00
Peter Kokot 51f39a0f32 Help: Fix install(SBOM) argument typo 2026-02-27 16:51:39 -05:00
Brad King 1202254cd5 Merge topic 'improve-doc-consistency'
277c12a4c7 Help: Improve command usage formatting consistency

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11687
2026-02-16 08:43:11 -05:00
Matthew Woehlke 277c12a4c7 Help: Improve command usage formatting consistency
Try to be a bit more consistent about:

- Placing angle brackets around text which serves as a placeholder
  rather than being literal.

- Using curly brackets rather than angle brackets to denote groups where
  one of the options is required.

- Describing optional list arguments like `<x>...` rather than
  `[<x>...]`. (Instances of lists not associated with keywords are
  intentionally left as-is, however.)

Also, teach our CMake lexer to understand curly braces used as above
(prior uses were only in parsed literals without syntax highlighting),
and to highlight them (and remaining uses of angle braces) as the type
Punctuation rather than the type Operator, for consistency with square
braces.
2026-02-13 12:54:37 -05:00
Brad King eec5d93813 Merge topic 'update_sbom_docs_gen_exp'
54ac3937b6 Help: Warn about generator expressions in install(SBOM) docs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11685
2026-02-13 09:52:39 -05:00
Tom Osika 54ac3937b6 Help: Warn about generator expressions in install(SBOM) docs 2026-02-12 12:07:47 -05:00
Matthew Woehlke f5c515cbf2 CPS: Remove experimental gate (mostly)
Remove basic CPS import and export from 'experimental' status. Update
documentation and tests accordingly.

Note that mapped exports (CMAKE_EXPERIMENTAL_MAPPED_PACKAGE_INFO) are
still experimental.
2026-02-11 16:10:29 -05:00
Christoph Grüninger 231b336ad2 Help: Fix typo in install documentation 2026-02-05 08:02:05 +01:00
Christoph Grüninger 01ea8dc368 Help: Correct use of dots ([...]) in install command signatures
Only the short form of command have the [...] at
the end to indicate further possible arguments.
Repeating of a block is indicated by ..., not [...].
2026-02-05 07:57:32 +01:00
Vito Gamberini 3771471310 CPS: Support C++20 modules
Modify the PackageInfo exporters and commands to support C++20 modules
via the collator-generated module manifest.

Fixes #27548
2026-01-29 13:26:35 -05:00
Taylor Sasser 8ec5a595cd cmSbom: Add documentation for install(SBOM) and export(SBOM) 2025-12-17 14:35:12 -05:00
Matthew Woehlke 34343922a5 install: Add ability to generate CPS from install(EXPORT)
Add the ability to generate CPS package information when install(EXPORT)
is used. This relies on additional information to be passed to CMake,
and is intended as a way of getting CPS out of existing projects without
needing to make changes to the projects' CMakeLists.txt. (Particularly,
this feature is intended for package distributors, not project authors.)
2025-11-11 11:51:58 -05:00
Brad King 318f90ff5f Merge topic 'revert-install-DIRECTORY-exclude-empty'
21e99dbf49 install(DIRECTORY): Revert "Add EXCLUDE_EMPTY_DIRECTORIES option"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10977
2025-07-29 09:40:54 -04:00
Brad King 21e99dbf49 install(DIRECTORY): Revert "Add EXCLUDE_EMPTY_DIRECTORIES option"
Revert commit b70ef48b27 (install(DIRECTORY): Add
EXCLUDE_EMPTY_DIRECTORIES option, 2025-04-20, v4.1.0-rc1~212^2).
The implementation had at least two problems:

* It did not exclude the top-level directory if empty.
* It did not exclude non-empty directories whose contents are
  all filtered out.

Revert the feature pending a revised implementation.

Issue: #19189
Closes: #27092
2025-07-28 14:21:09 -04:00
Matthew Woehlke 755a24ccae CPS: Add export support for [default_]license
Add `LICENSE` and `DEFAULT_LICENSE` arguments to the `PACKAGE_INFO`
modes of the `install` and `export` commands. If not otherwise
specified, the `LICENSE` will be taken from the project's
`SPDX_LICENSE`, if available.
2025-06-20 14:01:25 -04:00
Matthew Woehlke f0b419c473 Help: Tweak project DESCRIPTION documentation
Replace the 'project-description-string' descriptor in the `project`,
`export` and `install` commands with 'description-string'. This is more
consistent, as none of the other descriptors include 'project-', and
it's arguably wrong in the context of `export`/`install`, as the
description applies to a package.
2025-06-20 14:01:25 -04:00
Matthew Woehlke da97747dac CPS: Support additional metadata
Add support for specifying CPS's supplemental `description` and
`website` attributes. Add ability to inherit these from the `project()`,
similar to how version information can be inherited.
2025-06-03 16:50:46 -04:00
Matthew Woehlke ecf81c1bc1 CPS: Get metadata from project
Modify {export,install}(PACKAGE_INFO) commands to inherit version
information from the current project in situations where it seems
reasonable to do so. Add an option to explicitly request inheritance
from a specific project.

This leverages the recently added project(COMPAT_VERSION).
2025-06-02 10:31:36 -04:00
Matthew Woehlke 551d4e399a Help: Improve CPS install documentation
Add documentation for several options related to CPS export/install that
were not previously documented. Add note to update documentation when
(if) COMPAT_VERSION support is not specific to CPS.
2025-05-27 12:28:05 -04:00
Hao Dong b70ef48b27 install(DIRECTORY): Add EXCLUDE_EMPTY_DIRECTORIES option
EXCLUDE_EMPTY_DIRECTORIES option excludes empty directories under the
directory to install. A directory is considered not empty if and only if
the directory contains at least one file or one symbolic link or one
none-empty sub-directory.

Closes: #19189
2025-05-06 10:59:24 -04:00
Brad King 0fb355143e Help: Reformat install(DIRECTORY) options as a definition list
This makes it easier to find documentation for each option.
Previously they were sprinkled throughout prose.  It also
provides a good place for ``versionadded`` directives.
2025-05-05 15:05:33 -04:00
Brad King 7f172faca5 Help: Add install() section heading for common options 2025-02-25 13:26:32 -05:00
Peter Kokot 4e6a13f211 Use lower case style for commands
Where possible this syncs the CS for command names:

- check_c_source_compiles()
- check_cxx_compiler_flag()
- check_cxx_source_compiles()
- check_cxx_symbol_exists()
- check_include_file_cxx()
- check_include_file()
- check_include_files()
- check_library_exists()
- check_source_compiles()
- check_struct_has_member()
- check_symbol_exists()
- check_type_size()
- cmake_dependent_option()
- cmake_parse_arguments()
- feature_summary()
- file()
- find_package_handle_standard_args()
- if(), endif...
- install(FILES)
- list()
- message()
- pkg_check_modules()
- select_library_configurations()
- set_package_info()
- test_big_endian()
2025-01-28 13:51:46 -05:00
Peter Kokot 5a974b99fe install: Document where the components are used 2025-01-20 12:02:23 +01:00
Brad King fdceee50e6 Merge topic 'normalize-install-destination-paths'
6a1fac1450 install: Normalize DESTINATION paths
2184fcfb00 Tests: Configure RunCMake.install cases with correct build type
5a8a6dfe81 cmGeneratorExpression: Change Find() parameter type to cm::string_view
d810374b3d install(PACKAGE_INFO): Remove outdated TODO comment
d13ed01d54 Tests: Remove unused files from RunCMake.install

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9800
2024-09-20 10:27:30 -04:00
Craig Scott 6a1fac1450 install: Normalize DESTINATION paths
The file generated by install(EXPORT) computes _IMPORT_PREFIX
in a way that assumes a normalized path. If the DESTINATION
contains any ../ components, the computed _IMPORT_PREFIX
would be wrong. Force the DESTINATION path to be normalized,
subject to the new CMP0176 policy.

Also normalize all other DESTINATION paths for consistency,
except for INCLUDES DESTINATION, which is not strictly a
destination but rather a search path to add.

Fixes: #26252
2024-09-19 20:31:47 +10:00
Chen Linxuan 39603a7e5c install: Add TYPE LIBEXEC for FILES and DIRECTORY
Signed-off-by: Chen Linxuan <me@black-desk.cn>
2024-09-18 11:05:28 -04:00
Brad King 72607d3402 Merge topic 'cps-export'
b2dc1bd149 CMake: Suppress IBM XL optimization warning
1a846c8849 Tests: Add tests for install(PACKAGE_INFO)
3d52d70b84 export: Add initial CPS support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9693
2024-08-27 09:43:51 -04:00
Matthew Woehlke 3d52d70b84 export: Add initial CPS support
Add initial support for exporting (install only, for now) Common Package
Specification (https://cps-org.github.io/cps/) format package
descriptions. This has some limitations, such as not supporting
generator expressions (as these cannot be portably exported), and only
partially supporting transitive dependencies, but should be usable for
at least some simple cases. (Actually, $<LINK_ONLY> is theoretically
supportable, but is not yet implemented.)

This still needs tests; these will be added in the next commit. Other
potential improvements include support for language-specific compile
definitions and inferring some package properties from project
properties. Additionally, there is no module support yet; this is partly
pending on having a tool agnostic format for providing the necessary
information.
2024-08-14 15:25:27 -04:00
FeRD (Frank Dana) 38aae609df Help(install): Move RENAME docs to FILES signature
The document's intro claims that the options documented up top are
the ones common to multiple signatures, but `RENAME` is only valid
for `install(FILES ...)`. Move it to that section of the docs.
2024-08-01 12:41:43 -04:00
Martin Duffy 159ba027b9 Install: Add parallel installation option
Fixes: #26000
2024-07-15 11:49:29 -04:00
FeRD (Frank Dana) 8cbd6f5754 Help: Fix location of install() note about superseded commands
The note regarding commands superseded by install() somehow wound
up nested under the install(EXPORT) signature, when it has nothing
to do with install(EXPORT). Move it to the top level, immediately
before the Examples section.
2024-03-28 16:59:00 -04:00
Brad King 3a739d4dcb EXPORT_PACKAGE_DEPENDENCIES: Add experimental feature gate
Some design concerns have been raised after trying the 3.29 release
candidates.  Avoid committing to a stable public interface for now.

Issue: #25767
2024-03-12 14:24:53 -04:00
Robert Maynard af293ff7c3 Help: Explicitly discourage absolute install destinations
Document some of the problems caused by absolute install destinations.
Encourage use of relative paths.
2024-02-16 09:53:55 -05:00
c6e6861e63 install(EXPORT): Export find_dependency() calls
Issue: #20511
Co-Authored-by: Brad King <brad.king@kitware.com>
Co-Authored-by: Robert Maynard <rmaynard@nvidia.com>
2023-11-13 11:07:52 -05:00