1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-10 15:12:19 +08:00

224 Commits

Author SHA1 Message Date
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Brad King
1d4d4362d9 Merge topic 'remove-old-compatibility'
77f71ad4e2 Remove compatibility with CMake versions older than 3.5
fb1bd1d330 CMP0065: Remove support for OLD behavior
d9dd38cccf CMP0064: Remove support for OLD behavior
d88047c329 Remove compatibility with CMake versions older than 3.3
ac1a9cb160 CMP0063: Remove support for OLD behavior
36fffb673a CMP0062: Remove support for OLD behavior
789a7d73d4 CMP0061: Remove support for OLD behavior
3dc19e24cb CMP0060: Remove support for OLD behavior
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10210
2025-01-23 09:36:59 -05:00
Brad King
36fffb673a CMP0062: Remove support for OLD behavior 2025-01-22 10:40:54 -05:00
Brad King
10cfc8f538 Merge topic 'extern-domain'
e109307c43 Add support for foreign targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10171
2025-01-22 09:30:49 -05:00
Vito Gamberini
e109307c43
Add support for foreign targets 2025-01-21 15:26:40 -05:00
Brad King
888259c894 CMP0022: Remove support for OLD behavior 2025-01-18 09:51:45 -05:00
Brad King
5fd46699fc CMP0006: Remove support for OLD behavior 2025-01-17 09:28:35 -05:00
Brad King
659d8bd430 cmPolicies: Remove now-unused REQUIRED_IF_USED and REQUIRED_ALWAYS states 2024-11-13 11:43:07 -05: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
Craig Scott
d810374b3d
install(PACKAGE_INFO): Remove outdated TODO comment
The DESTINATION keyword is supported for this form.
2024-09-18 08:39:58 +10: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
Matthew Woehlke
20fa4ce8d8 export: Factor out CMake-specific export generation (2/2)
In order to support generation of Common Package Specifications, the
mechanisms CMake uses to export package information need to be made more
abstract. The prior commits began this refactoring; this continues by
(actually) restructuring the classes used to generate the actual export files.
To minimize churn, this introduces virtual base classes and
diamond inheritance in order to separate logic which is format-agnostic
but depends on the export mode (build-tree versus install-tree) from
logic which is format-specific but mode-agnostic.

This could probably be refactored further to use helper classes instead,
and a future commit may do that, however an initial attempt to do that
was proving even more invasive, such that this approach was deemed more
manageable.

While we're at it, add 'const' in more places where possible.
2024-07-23 12:13:39 -04:00
Matthew Woehlke
a6cc595772 export: Factor out CMake-specific export generation (1/2)
In order to support generation of Common Package Specifications, the
mechanisms CMake uses to export package information need to be made more
abstract. As a first step toward this, refactor cmInstallExportGenerator
so that logic specific to config.cmake and Android .mk lives in separate
subclasses.

While we're at it, clean up the code style a bit and try to use moves a
bit more consistently.

This is step 1 of 2. The next step will refactor the individual file
generators along similar lines, which will also involve creating
additional classes for format-agnostic logic that is shared between
build-tree and install-tree variants.
2024-07-18 12:08:43 -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
Kyle Edwards
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
Ben Boeckel
0c07f39006 cmExperimental: remove the flag for C++ modules
All the major compilers now have scheduled releases with support for
scanning, so remove the experimental gate.

Fixes: #18355
2023-10-02 10:17:31 -04:00
scivision
d49ea4a4d9
Source: Remove redundant FileIsDirectory checks 2023-09-18 23:11:28 -04:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Marc Chevrier
ede33f30cf Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
2023-03-01 12:23:28 +01:00
Kyle Edwards
18e02ace5b install(CODE|SCRIPT): Support $<INSTALL_PREFIX> genex
Fixes: #24534
2023-02-24 10:17:45 -05:00
Brad King
316960ded0 cmInstallCommand: Drop unused local variable 2022-07-20 16:03:12 -04:00
Brad King
e6d1e29ffa cmArgumentParser: Model maybe-empty and non-empty lists with wrapper types
Previously bindings to `std::vector<std::string>` required at least one
value.  Some clients have been filtering `keywordsMissingValue` to
support keywords followed by empty lists.  Instead, require clients to
specify whether a keyword's list can be empty as part of the binding
type.
2022-07-07 09:48:58 -04:00
Ben Boeckel
fe44cbe9e7 exports: support CXX_MODULES_DIRECTORY
This directory will be used to store build-discovered information about
targets such as the modules provided by the files in the relevant
`FILE_SET` types.

A directory is used because basing the name on a `<FILE_NAME>-*.cmake`
pattern makes it end up being globbed in the configuration-dependent
information mechanism. Since old modules and targets may be around,
unconditionally including them may refer to targets that do not actually
exist.
2022-07-06 10:15:23 -04:00
Ben Boeckel
29118091dc install: support CXX_MODULES_BMI installation bits 2022-07-06 10:15:23 -04:00
Brad King
5446b15c5c cmInstallCommand: Use cm::optional for keyword argument presence 2022-07-05 16:48:17 -04:00
Brad King
1ee5a4a548 cmArgumentParser: Avoid allocating copies of keyword strings 2022-07-05 16:34:57 -04:00
Brad King
49c96c6508 Merge topic 'file-set-build-export'
9ee47188c0 cmExportBuildFileGenerator: handle genex-wrapped source paths
60fab8a6e0 cmInstallCommand: tweak error message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7182
2022-04-21 11:49:40 -04:00
Ben Boeckel
60fab8a6e0 cmInstallCommand: tweak error message
Not all filesets need to be installed; just those that are visible on
the target's interface. Clarify the error message.
2022-04-15 20:44:53 -04:00
Hyper Nova Sun
41ba35a42b cmTarget: Add HasKnownObjectFileLocation() shorthand
Allow `cmGlobalGenerator`s to decide `HasKnownObjectFileLocation()` per given
`cmTarget`

- `cmGlobalGenerator::HasKnownObjectFileLocation()` now takes an optional `cmGeneratorTarget`
- `cmTarget::HasKnownObjectFileLocation()` added as a shorthand
2022-04-11 14:10:29 -07:00
Brad King
11cc728e75 cmConstStack: Factor out of cmListFileBacktrace
This presents value semantics for a stack of constant values.
Internally it shares ownership to avoid copies.  Previously
this was implemented by `cmListFileBacktrace` explicitly,
but the approach can be re-used for other kinds of stacks.
2022-04-02 05:55:31 -04:00
Kyle Edwards
058b8a0bfb install(): Properly ignore FILE_SETs that don't exist
Fixes: #22960
2022-02-17 14:43:06 -05:00
Brad King
5a65e08644 Merge topic 'restore-target-export-includes' into release-3.23
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6969
2022-02-10 09:07:34 -05:00
Eugene Shalygin
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION
In commit 55e4753bbb (Refactor cmTargetExport removing
InterfaceIncludeDirecories, 2021-07-20, v3.22.0-rc1~337^2~1) the storage
of `INCLUDES DESTINATION` was moved into each target.  However, a target
may be installed in multiple exports, and their `INCLUDES DESTINATION`
should not be mixed.

Convert the IncludeDirectoriesEntries vector to a map and modify access
function to store the directories lists with respect to cmExportTarget
object. This fixes error when the same target is exported more than once
via different exports and each for consequent export its include
directories list grows. Add a test for this case.

Fixes: #23183
2022-02-09 13:31:26 -05:00
Brad King
562ee8a50b Merge topic 'misc-messages'
dbe33b20bd install: Add context to {PUBLIC,PRIVATE}_HEADER/RESOURCE DESTINATION warnings
1a25f057da cmComputeLinkInformation: Add context to warning about linking a directory
4862f3b2c8 cmcmd: Write progress and tar errors directly to stderr
efc6c23a47 bootstrap: Do not declare cmSystemTools functions that are not implemented

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6680
2021-11-01 09:07:13 -04:00
Kyle Edwards
2a78d47b16 install(EXPORT): Install file sets 2021-10-27 15:17:23 -04:00
Kyle Edwards
9b479124cc install(TARGETS): Add FILE_SET mode 2021-10-27 15:17:23 -04:00
Brad King
dbe33b20bd install: Add context to {PUBLIC,PRIVATE}_HEADER/RESOURCE DESTINATION warnings 2021-10-27 12:59:16 -04:00
Sean McBride
37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings 2021-09-28 10:53:54 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Eugene Shalygin
55e4753bbb Refactor cmTargetExport removing InterfaceIncludeDirecories
Because of this property in the cmTargetExport struct, exporting targets
is not uniform: top-level ones have to be dealt with via the
cmTargetExport objects, while all linked ones are cmGeneratorTarget
objects. Let's pass this additional includedirectories via a special
target property making handling exported targets uniform.
2021-07-22 13:08:58 +02:00
Kyle Edwards
4910132d8c install: Add RUNTIME_DEPENDENCY_SET mode 2021-06-04 08:52:02 -04:00
Kyle Edwards
bc8a4a06a4 install(IMPORTED_RUNTIME_ARTIFACTS): Add RUNTIME_DEPENDENCY_SET option 2021-06-04 08:52:02 -04:00
Kyle Edwards
3e7d3c252a install(TARGETS): Add RUNTIME_DEPENDENCY_SET argument 2021-06-04 08:52:02 -04:00
Kyle Edwards
ed3633d88c install(TARGETS): Add RUNTIME_DEPENDENCIES option 2021-06-04 08:52:02 -04:00
Kyle Edwards
df7040a271 install(): Add IMPORTED_RUNTIME_ARTIFACTS mode 2021-05-31 09:02:45 -04:00
Nils Gladitz
99ff75455e install: Implement new install(CODE|SCRIPT) option ALL_COMPONENTS
In a per-component installation the generated installation scripts
are invoked once for each component.

Per default custom installation script code added by install(CODE|SCRIPT)
only runs for one specific component in this context.

The new ALL_COMPONENTS option allows custom script code to be run once
for each component being installed.
2021-05-19 19:17:58 +02:00
Brad King
553cd4db44 Merge topic 'fixAppleResourceWarning'
169da7cd81 Do not show RESOURCE DESTINATION warning for MACOSX_BUNDLE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6104
2021-05-11 09:27:45 -04:00
Mike Achtelik
169da7cd81 Do not show RESOURCE DESTINATION warning for MACOSX_BUNDLE
RESOURCE arguments are ignored on Apple platforms because the
associated files are installed into the appropriate locations
inside the framework folder. So we do not need to show a warning,
that no RESOURCE DESTINATION is defined.

Fixes #15676
2021-05-07 21:16:08 +02:00