1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-22 20:34:08 +08:00

965 Commits

Author SHA1 Message Date
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
633afa0b2e cmGeneratorExpressionDAGChecker: Make config name available in constructor 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
09c74c6d0c cmGeneratorTarget: Factor transitive property methods into own source 2024-05-20 19:29:15 -04:00
Brad King
feaca40931 cmGeneratorTarget: Factor link interface/impl methods into own source 2024-05-20 19:28:06 -04:00
Brad King
b4924c562a cmGeneratorTarget: Factor compatible interface properties into own source 2024-05-20 19:26:05 -04:00
Brad King
cdd7112a5d cmGeneratorTarget: Factor options-like usage requirements into own source 2024-05-20 19:24:48 -04:00
Brad King
881a46819e cmGeneratorTarget: Factor LINK_DIRECTORIES impl into own source 2024-05-20 19:23:13 -04:00
Brad King
0a3c97308d cmGeneratorTarget: Factor INCLUDE_DIRECTORIES impl into own source 2024-05-20 19:21:45 -04:00
Brad King
7ffb92022c cmGeneratorTarget: Factor SOURCES impl into own source 2024-05-20 19:20:21 -04:00
Brad King
d0fc932528 cmGeneratorTarget: Factor TargetPropertyEntry into own source 2024-05-20 19:16:57 -04:00
Brad King
abf60adfa6 cmGeneratorTarget: Move TargetPropertyEntry creation method to header 2024-05-20 19:12:53 -04:00
Brad King
ed983b1a5d cmTargetTraceDependencies: Factor out of cmGeneratorTarget 2024-05-20 19:12:19 -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
1027c0e213 Merge topic 'cxxmodules-no-import-std-reason'
e89e819398 Tests/CXXModules: add tests for C++26 `import std` support
6dad18f060 cxxmodules: give a reason for unavailability of `import std`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9486
2024-05-03 09:26:39 -04:00
Ben Boeckel
6dad18f060 cxxmodules: give a reason for unavailability of import std
If the `CMAKE_CXX<STANDARD>_COMPILER_IMPORT_STD_NOT_FOUND_MESSAGE`
variable is set, include its value in the error message.
2024-05-02 14:46:51 -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
f909fc2f92 Merge topic 'export-name-safe-name' into release-3.28
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>
Merge-request: !9474
2024-05-01 09:28:59 -04:00
Brad King
2549f5a66e Merge topic 'exported-modules-with-headers'
2041f7c9bf cmGeneratorTarget: add the original target as a COMPILE_ONLY link
051c2110c8 Tests/CXXModules: test exporting modules which include headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9469
2024-04-30 10:10:36 -04:00
Brad King
ddb9442f48 GenEx: Fix TARGET_PROPERTY evaluation of transitive link properties
In commit bbba701899 (Link properties: must be transitive over private
dependency on static library, 2019-12-06, v3.17.0-rc1~323^2) and
commit af9d4f24ae (Link properties: must be transitive over private
dependency on static library, 2019-12-11, v3.17.0-rc1~305^2) we
neglected to implement CMP0099 NEW behavior for `TARGET_PROPERTY`
evaluation.  Add policy CMP0166 to fix this.
2024-04-29 17:40:03 -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
Brad King
e8010b67c7 cmGeneratorExpressionDAGChecker: Make local generator available in constructor
This is the local generator in the evaluation context, not that of
the current target/property pair.
2024-04-29 17:27:35 -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
Ben Boeckel
2041f7c9bf cmGeneratorTarget: add the original target as a COMPILE_ONLY link
Fixes: #25909
2024-04-26 20:15:05 -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
91a25de520 cmGeneratorExpression: Add comments on implementation details
Clarify the purpose of some genex code that collects properties over the
transitive link closure.
2024-04-12 11:50:55 -04:00
Ben Boeckel
15bbd1d9b8 Experimental: add an experimental feature gate for import std 2024-04-12 11:46:39 -04:00
Ben Boeckel
2c8361f923 cxxmodules: link to std-providing targets when available 2024-04-11 10:19:44 -04:00
Ben Boeckel
15cd73d6c2 cmGlobalGenerator: compute target features before synthetic targets
For `import std;` support, CMake needs to know the standard library
involved in order to ensure that the right target is linked. Afterwards,
the created synthetic targets need their target compile features
computed.
2024-04-11 10:19:44 -04:00
ClausKlein
eb66549c7c VERIFY_INTERFACE_HEADER_SETS: Suppress clang-tidy include checks
`clang-tidy-17` adds include checks similar to IWYU.  Suppress them in
generated code.
2024-04-08 19:15:21 -04:00
ClausKlein
b0773aa4f6 VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma as C-style comment
In commit 6942234bf5 (VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma:
associated to verification file, 2022-10-07, v3.25.0-rc1~22^2) the
comment was added as a C++-style comment.  The feature works in C too,
so use a C-style comment.
2024-04-08 19:10:10 -04:00
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Marc Chevrier
801ae06952 LINKER_TYPE: Support MOLD only on GCC versions that support it
Fixes: #25748
2024-03-13 11:13:21 -04:00
Marc Chevrier
939ac5287e LINKER_TYPE: fix spelling error in message 2024-03-12 18:18:25 +01:00
Brad King
4ff4417b54 Merge topic 'cxxmodules-fileset-cache-fullpath' into release-3.29
0a18f9baad cmGeneratorTarget: collapse paths before querying the fileset cache

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9286
2024-02-27 09:06:24 -05:00
Ben Boeckel
0a18f9baad cmGeneratorTarget: collapse paths before querying the fileset cache
Observed with paths with `../` when outside of the source tree. I
attempted to reproduce a test suite case for it but could not make it
happen.
2024-02-24 17:17:39 -05:00
Brad King
c66396699b Merge topic 'cxxmodules-transitive-modules-usage' into release-3.29
ec348ee4b9 cmGeneratorTarget: discover synthetic targets recursively
67466ddf65 cmExportFileGenerator: export link libraries as-is
a2e3e61a31 Tests/CXXModules: test transitive modules usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9273
2024-02-21 13:34:34 -05:00
Ben Boeckel
ec348ee4b9 cmGeneratorTarget: discover synthetic targets recursively
Fixes: #25288
2024-02-20 10:53:31 -05:00
Brad King
f18ba02d7e Merge topic 'cxxmodules-nmc-duplicate-synthetic-targets' into release-3.29
5261af9424 cmGeneratorTarget: store synthetic targets in its cache
e0633a9517 Tests/CXXModules: add a test importing from a `Ninja` install
150d7dbd68 Tests/CXXModules: support building a project with `Ninja`
e48e5e5506 Tests/CXXModules: document `CMake_TEST_MODULE_COMPILATION` items

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9263
2024-02-19 09:23:21 -05:00
Ben Boeckel
5261af9424 cmGeneratorTarget: store synthetic targets in its cache
The synthetic target cache was never actually updated, so record them in
the cache so that reuses can actually be discovered.

Fixes: #25568
2024-02-16 11:09:56 -05:00
Brad King
af076796c3 Merge topic 'cuda-clang-no-link-arch'
45d53bdb70 CUDA/Clang: Do not pass explicit architecture flags when linking

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Raul Tambre <raul@tambre.ee>
Merge-request: !9165
2024-01-19 11:40:38 -05:00
Brad King
4cd153afe3 Merge branch 'backport-cxxmodules-export-file-collisions' 2024-01-18 17:45:07 -05:00