Commit Graph

438 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
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
f8bc8780c1 CMP0026: Remove support for OLD behavior 2025-01-19 09:40:59 -05:00
Brad King
c965856a1d cmGeneratorTarget: Simplify storage of link implementation
With CMP0022 removed, the link implementation is now computed only
for the target itself, and never for a dependent head target.
2025-01-18 09:51:45 -05:00
Brad King
888259c894 CMP0022: Remove support for OLD behavior 2025-01-18 09:51:45 -05:00
Brad King
8ef1b4001b Merge topic 'remove-old-compatibility'
785523a136 Remove compatibility with CMake versions older than 2.8.0
35282387ea CMP0014: Remove support for OLD behavior
fad9c55b8b CMP0013: Remove support for OLD behavior
98a59ba8ad CMP0012: Remove support for OLD behavior
3c0dbb66f5 CMP0011: Remove support for OLD behavior
cf832e75bc CMP0010: Remove support for OLD behavior
77f8c374f3 CMP0009: Remove support for OLD behavior
43ef139567 CMP0008: Remove support for OLD behavior
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10188
2025-01-18 09:50:27 -05:00
Martin Duffy
9d34069ca8 instrumentation: Add targetLabels field to link snippets
Adds a new data field `targetLabels` to link snippets which contains a list of
text labels from the LABELS target property.
2025-01-17 11:07:30 -05:00
Brad King
9dd9321a18 CMP0003: Remove support for OLD behavior 2025-01-17 09:28:35 -05:00
Brad King
eb616ed6fd Merge topic 'fix-Fortran_BUILDING_INTRINSIC_MODULES'
b65930a7a7 Fortran: Add Fortran_BUILDING_INTRINSIC_MODULES for building intrinsics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10158
2025-01-13 11:22:05 -05:00
Brad King
675518ea81 Merge topic 'revert-genex-tco-subgraph'
a6b84a438f GenEx: Revert "Limit TARGET_PROPERTY transitive closure optimization"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10156
2025-01-10 09:21:04 -05:00
Alex Turbov
b65930a7a7 Fortran: Add Fortran_BUILDING_INTRINSIC_MODULES for building intrinsics
In commit fe3f846e1b (Makefiles: Add support for building Fortran
intrinsics, 2020-11-19, v3.22.0-rc1~565^2) the property was added with
incorrect spelling `Fortran_BUILDING_INSTRINSIC_MODULES`.  Add a new
property with the correct spelling.  Keep the old one for compatibility.

Issue: #21463
2025-01-09 15:30:00 -05:00
Brad King
a6b84a438f GenEx: Revert "Limit TARGET_PROPERTY transitive closure optimization"
Revert commit 4a11772618 (GenEx: Limit TARGET_PROPERTY transitive
closure optimization to subgraphs, 2024-05-31, v3.31.0-rc1~114^2).
The change caused substantial performance regressions in some
existing use cases.  Revert it pending further investigation.

Issue: #25728
Fixes: #26457
2025-01-09 11:56:20 -05:00
Marc Chevrier
521a6d409c Archive library: Add support for ARCHIVER: prefix
Add the support of the ARCHIVER: prefix to offer a portable way to pass
options to the archiver when the compiler is used as driver.
2024-11-26 19:26:07 +01:00
Brad King
a35f4cbbca cmGeneratorTarget: Remove unused ComputeLinkInterface signature 2024-11-20 10:54:01 -05:00
Brad King
e12e5e0566 cmGeneratorTarget: Simplify ComputeVersionedName signature 2024-10-10 13:10:13 -04:00
Brad King
ac410c7add Merge topic 'genex-tco-subgraph'
4a11772618 GenEx: Limit TARGET_PROPERTY transitive closure optimization to subgraphs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !9789
2024-09-11 09:33:28 -04:00
Michael Herwig
4a11772618 GenEx: Limit TARGET_PROPERTY transitive closure optimization to subgraphs
Fixes: #25728
2024-09-10 13:24:24 +02:00
Ben Boeckel
670f753f24 cmDyndepCollation: write build database metadata
Generators will hook this up into the build graph as needed.
2024-08-27 12:37:36 -04:00
Ben Boeckel
cedfaa010f cmGeneratorTarget: add a method to build classified command lines
This is essentially an extraction of the `Ninja` generator's command
line building logic. Porting generators to reuse this construction is a
task for the future.
2024-08-27 12:37:21 -04:00
Ben Boeckel
c66821b22b cmGeneratorTarget: add the concept of a "family" name
With synthetic targets, a name which is the same between all synthetic
targets which share a base target is warranted.
2024-08-27 11:30:23 -04:00
Orkun Tokdemir
7d8d239574 GeneratorTarget: Factor out AddSystemIncludeCacheKey() 2024-07-22 17:03:20 +02:00
Brad King
a8d8f26828 Merge topic 'aix-archive-shared-libraries'
d27fe9dfba AIX: Add option to archive shared libraries
98013ad1ca cmXCOFF: Add support for editing binary inside an archive

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9606
2024-07-19 09:55:58 -04:00
Aditya Vidyadhar Kamath
d27fe9dfba AIX: Add option to archive shared libraries
Add option `CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`.

There will no versions for the shared objects when this option is used.

Closes: #26033
2024-07-17 11:52:09 -04:00
Brad King
7a77a6c642 Restore support for exporting INTERFACE with missing dependencies
Since commit c16acd35b3 (GenEx: Add support for custom transitive link
properties, 2024-05-09, v3.30.0-rc1~82^2) evaluation of
`TRANSITIVE_LINK_PROPERTIES` by `install(EXPORT)` enables discovery of
missing dependencies on INTERFACE libraries that we did not previously
diagnose.  This regressed existing projects that relied on such
non-diagnosis.  Although commit 2fc9e482a9 (Evaluation of
TRANSITIVE_LINK_PROPERTIES isn't considered a usage, 2024-07-05) fixed
this, it also made a significant change to the `UseTo` infrastructure
that may have other subtle effects.  Replace the fix with an approach
that explicitly models suppression of the relevant diagnostics.

Fixes: #26108
2024-07-15 14:08:10 -04:00
Robert Maynard
2fc9e482a9 Evaluation of TRANSITIVE_LINK_PROPERTIES isn't considered a usage
Fixes #26108
2024-07-05 13:16:47 -04:00
Dave Abrahams
5bb7f8a4dd Swift: Use per-config module file locations in multi-config generators
Place `.swiftmodule` files a subdirectory named after the configuration.

Fixes: #25864
Fixes: #25997

- Swift/RunCMakeTest.cmake:
  - CMP0157-OLD was enabled for Xcode, where it works.
  - A test was added that verifies .swiftmodule's are generated into
    separate directories with multi-config generators.

- Tests/SwiftOnly/CMakeLists.txt: tests were added that validate that
  cross-subdirectory module dependencies (via target_link_libraries)
  work.
2024-05-24 15:23:41 -07:00
Dave Abrahams
b2e042d77a cmGeneratorTarget: Adopt Swift-related methods from the Ninja generator
They will see more use as Swift bugs are fixed in the
Ninja Multi-Config generator.
2024-05-24 15:20:08 -07:00
Brad King
b9ee79b8a1 GenEx: Add support for custom transitive compile properties
Teach the `$<TARGET_PROPERTY:...>` generator expression to check for a
new `TRANSITIVE_COMPILE_PROPERTIES` property in the target's link
closure to enable transitive evaluation of named properties through
the link closure, excluding entries guarded by `$<LINK_ONLY:...>`.

Issue: #20416
2024-05-21 09:22:51 -04:00
Brad King
e64d09a729 cmGeneratorTarget: Add GetLinkImplementationClosure mode for linking
Previously this method always returned the closure for compile-only
usage requirements.  Add an option to get the closure for linking, which
pierces `$<LINK_ONLY>`.
2024-05-21 09:22:51 -04:00
Brad King
a11cbcc268 cmGeneratorTarget: Add TransitiveProperty constructor to help some compilers
Some compilers have trouble initializing TransitiveProperty as a parent
class using an initializer list unless there is an explicit constructor:

* SunPro fails to compile
* XLClang seems to miscompile, exhibiting strange runtime behavior
2024-05-21 09:22:51 -04:00
Brad King
feaca40931 cmGeneratorTarget: Factor link interface/impl methods into own source 2024-05-20 19:28:06 -04:00
Brad King
abf60adfa6 cmGeneratorTarget: Move TargetPropertyEntry creation method to header 2024-05-20 19:12:53 -04:00
Brad King
ff1693cb3c cmGeneratorTarget: Clarify enum for specifying purpose of usage requirements
Since commit 1e49880472 (cmGeneratorTarget: Avoid boolean trap in usage
requirement lookup, 2021-12-08, v3.23.0-rc1~245^2) we have clarified
the distinction between compile-only and link-only usage requirements.
Rename the `LinkInterfaceFor` enum to `UseTo` to clarify that its role
is to specify the purpose of usage requirements.
2024-05-03 13:04:10 -04:00
Brad King
662d4c5315 cmGeneratorTarget: Clarify name for evaluating compile-only usage requirements 2024-05-03 13:04:09 -04:00
Brad King
721b86c02b Merge topic 'pch-single-arch'
ef006ebd9b PCH: Use per-arch .pch files only when building multiple Apple architectures
99bfb430ee cmNinjaTargetGenerator: Remove unused Apple architecture list

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9483
2024-05-02 09:44:48 -04:00
Brad King
718f43e7ee Merge topic 'vs-scan-module-deps-settings'
3022f0363f VS: set ScanSourceForModuleDependencies at vcxproj level
dff511ad28 cmGeneratorTarget: add a target-level query for "needs dyndep"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: AaronRuizMoraUK <aaronruizmora@gmail.com>
Merge-request: !9471
2024-05-02 09:40:04 -04:00
Brad King
ef006ebd9b PCH: Use per-arch .pch files only when building multiple Apple architectures
Since commit f593b354da (PCH: Add support for multi architecture iOS
projects, 2020-04-02, v3.18.0-rc1~414^2) we use per-arch .pch files
even when compiling for just the host architecture on macOS arm64.
This breaks with compilers that do not support `-Xarch_` flags, such
as GCC.  Avoid using per-arch .pch files in single-architecture builds.

Fixes: #25514
Issue: #20497
2024-05-01 12:43:39 -04:00
Brad King
de9faaf0a3 Merge topic 'genex-link-properties'
ddb9442f48 GenEx: Fix TARGET_PROPERTY evaluation of transitive link properties
862b8e28ad GenEx: Teach TARGET_PROPERTY evaluation to optionally pierce LINK_ONLY
8d1d6a1437 Tests: Cover TARGET_PROPERTY genex evaluation of transitive link properties
abf607c2ec Tests: Cover TARGET_PROPERTY genex evaluation of transitive build properties
7d3d728a72 Help: Clarify CMP0099 documentation and summary text
79a3ae9a0d cmGeneratorExpressionDAGChecker: Simplify transitive property table
e8010b67c7 cmGeneratorExpressionDAGChecker: Make local generator available in constructor
b36fb3f6f1 cmGeneratorExpressionNode: Remove outdated lint suppression

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9473
2024-05-01 10:06:11 -04:00
Ben Boeckel
dff511ad28 cmGeneratorTarget: add a target-level query for "needs dyndep"
This can still be overridden per-source, but it indicates the state of
the target's default behavior.
2024-05-01 09:41:07 -04:00
Brad King
be111897b3 Merge topic 'export-name-safe-name'
142a85f9c1 cxxmodules: use filesystem-safe export names in filenames
4452d41488 cmGeneratorTarget: add method to get a filesystem-safe export name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9474
2024-05-01 09:29:57 -04:00
Brad King
862b8e28ad GenEx: Teach TARGET_PROPERTY evaluation to optionally pierce LINK_ONLY 2024-04-29 17:40:03 -04:00
Brad King
79a3ae9a0d cmGeneratorExpressionDAGChecker: Simplify transitive property table
Refactor the table of builtin transitive properties to avoid
preprocessor-generated cascading-if blocks with duplicate code.
2024-04-29 17:39:12 -04:00
Ben Boeckel
4452d41488 cmGeneratorTarget: add method to get a filesystem-safe export name
C++ module support puts the export name in a filename. Export names with
`:` in them are not valid filenames on Windows. Add a method to escape
names as necessary.

See: #25828
2024-04-29 17:23:08 -04:00
Brad King
e449417f94 Merge topic 'genex-cleanup'
895efd4e7a cmGeneratorExpression: Consolidate recognition of transitive properties
5f7d8192da cmGeneratorExpression: Inline evaluation helper at only call site
91a25de520 cmGeneratorExpression: Add comments on implementation details
0a61116f52 cmGeneratorTarget: Remove EvaluateInterfaceProperty argument default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9425
2024-04-15 10:16:35 -04:00
Brad King
0a61116f52 cmGeneratorTarget: Remove EvaluateInterfaceProperty argument default
Pass it explicitly at the call sites.
2024-04-12 11:50:52 -04:00
Ben Boeckel
2c8361f923 cxxmodules: link to std-providing targets when available 2024-04-11 10:19:44 -04:00
Brad King
2ce2aebb6f Merge topic 'restore-link-interface-objlib-with-unity'
5b8e9e068f Restore support for TARGET_OBJECTS in link interfaces with unity builds
1313c78a9c Tests: Update RunCMake.TargetObjects cmake_minimum_required version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9279
2024-02-22 08:26:12 -05:00
Brad King
5b8e9e068f Restore support for TARGET_OBJECTS in link interfaces with unity builds
This was broken by commit df08c37a42 (cmGlobalGenerator: Add unity/pch
sources after computing compile features, 2024-02-02, v3.28.3~1^2~1^2),
and 3.28.2's commit 76b5383123 (cmGlobalGenerator: add unity sources
after computing target compile features, 2024-01-01, v3.28.2~17^2~1).

The problem is very similar to that fixed by commit 4e8f24e977 (PCH:
Clear link interface cache when adding PCH object to it, 2022-01-24,
v3.23.0-rc1~44^2~9).  Generalize that fix.

Fixes: #25696
2024-02-21 17:08:57 -05:00
Brad King
2c6ec6de15 Link to transitive dependencies on stub libraries only on some linkers
Only linkers that enforce `--no-allow-shlib-undefined` recursively need
to link private transitive dependencies on stub libraries explicitly.
2024-01-04 11:59:26 -05:00