1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Commit Graph

306 Commits

Author SHA1 Message Date
Martin Duffy
f195c9ef2a genex: Add TARGET_INTERMEDIATE_DIR expression
Fixes: #27196
2025-10-09 08:07:20 -04:00
Martin Duffy
5c5634db52 cmGeneratorExpressionNode: Factor out HasKnownObjectFileLocation check 2025-10-08 17:34:02 -04:00
Craig Scott
1b764b6816 cmLinkItem: Remove redundant cmLinkImplItem class
The cmLinkImplItem class used to contain some additional members
to support the CMP0027 policy. Since the CMP0027 policy and those
associated members were removed, the cmLinkImplItem class has been
a plain wrapper around cmLinkItem with no additional members.
It is no longer needed and cmLinkItem can be used directly wherever
cmLinkImplItem was used previously.
2025-10-07 10:44:28 -04:00
Brad King
7d551a5d6b Merge topic 'genex-transitive-link-libraries'
e0bbe79cea CMP0189: Restore support for linking `$<TARGET_PROPERTY:tgt,LINK_LIBRARIES>`
cb69f750bf cmGeneratorTarget: Factor out helper to detect LINK_LIBRARIES evaluation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11262
2025-09-30 09:59:09 -04:00
Brad King
e0bbe79cea CMP0189: Restore support for linking $<TARGET_PROPERTY:tgt,LINK_LIBRARIES>
In general we disallow references to transitive target properties, such
as `COMPILE_DEFINITIONS`, in `[INTERFACE_]LINK_LIBRARIES` properties,
because the latter establish the transitivity itself.  Prior to CMP0189,
the `[INTERFACE_]LINK_LIBRARIES` properties were not themselves transitive
in `$<TARGET_PROPERTY>` expressions, so existing projects have code like

    target_link_libraries(foo PRIVATE "$<TARGET_PROPERTY:tgt,LINK_LIBRARIES>")

Policy CMP0189's NEW behavior, introduced by commit b3da9c6d60 (GenEx:
Evaluate LINK_LIBRARIES target properties transitively, 2025-02-24,
v4.1.0-rc1~731^2), makes `$<TARGET_PROPERTY:tgt,LINK_LIBRARIES>`
transitive, causing the above to be rejected.  Since evaluation of a
target's link libraries can already encounter and handle other targets'
link libraries, allow it in this case.

Fixes: #27265
2025-09-29 10:51:01 -04:00
Brad King
6e1de32c9d Merge topic 'pdb-postfix'
7a154bf4fd GenEx: Add POSTFIX option to $<TARGET_PDB_FILE_BASE_NAME>
5654207925 PDB: Always add the target per-config POSTFIX to .pdb names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11235
2025-09-26 09:26:49 -04:00
Marc Chevrier
7a154bf4fd GenEx: Add POSTFIX option to $<TARGET_PDB_FILE_BASE_NAME>
Extend commit 0b055a8893 (GenEx: add POSTFIX option to
$<TARGET_FILE_BASE_NAME>, 2025-09-07) to cover PDB names too.
2025-09-25 11:02:44 +02:00
Marc Chevrier
5654207925 PDB: Always add the target per-config POSTFIX to .pdb names
Manage the POSTFIX target property in the same way as other artifacts
names.  Add policy CMP0202 for compatibility.

Fixes: #27206
2025-09-25 11:00:39 +02:00
Brad King
26413a3e3d Merge topic 'file-GENERATE-CMP0189'
deb7b4b658 file(GENERATE): Record CMP0189 at each call site
9b862e7013 cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11234
2025-09-24 08:45:14 -04:00
Brad King
9b862e7013 cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty 2025-09-23 10:57:22 -04:00
Marc Chevrier
0b055a8893 GenEx: add POSTFIX option to $<TARGET_FILE_BASE_NAME>
Fixes: #27189
2025-09-23 00:19:53 +02:00
Brad King
2a14338676 Merge branch 'backport-genex-refactor' into genex-refactor 2025-09-21 20:22:24 -04:00
Brad King
e4708f007b GenEx: Factor out a dedicated evaluation Context structure
The context's local generator, configuration name, and language are
constant throughout evaluation.
2025-09-21 20:21:37 -04:00
Brad King
4697f7122b GenEx: Rename cmGeneratorExpressionContext to cm::GenEx::Evaluation
It has grown to hold information about the evaluation itself,
not just the context in which the evaluation occurs.
2025-09-21 20:21:32 -04:00
Brad King
d1c780886e Merge branch 'backport-genex-refactor' into genex-refactor 2025-09-21 20:20:39 -04:00
Brad King
77570a1ac1 GenEx: Consolidate target property evaluation context arguments 2025-09-21 20:20:03 -04:00
Brad King
1735b0d147 GenEx: Construct cmGeneratorExpressionDAGChecker with full evaluation context
Extend commit e8010b67c7 (cmGeneratorExpressionDAGChecker: Make local
generator available in constructor, 2024-04-25, v3.30.0-rc1~172^2~6) and
commit 633afa0b2e (cmGeneratorExpressionDAGChecker: Make config name
available in constructor, 2024-05-08, v3.30.0-rc1~82^2~2) to make the
full evaluation context available in the constructor.
2025-09-21 20:20:03 -04:00
Brad King
905cfcfa12 cmGeneratorExpressionNode: Simplify EvaluateDependentExpression signature
The local generator is available in the evaluation context.
2025-09-21 18:58:55 -04:00
Brad King
b40a53e931 GenEx: Factor out a dedicated evaluation Context structure
The context's local generator, configuration name, and language are
constant throughout evaluation.
2025-09-21 18:58:55 -04:00
Brad King
e1035dc307 GenEx: Rename cmGeneratorExpressionContext to cm::GenEx::Evaluation
It has grown to hold information about the evaluation itself,
not just the context in which the evaluation occurs.
2025-09-21 18:58:55 -04:00
Eduard Voronkin
01147454e7 FASTBuild: Add generator
Fixes: #15294
2025-08-26 14:29:01 -07:00
Brad King
383406fc18 Merge topic 'pass-trivial-by-value'
b1fdab3cc1 source: Pass small and trivially copyable types by value
7829ea76ad source: Pass cmFileTime by value
99c10afc26 source: Pass trivial dap::*Event by value
0bcb8d6e3c source: Pass cmFileAPI::Object by value
964e992ec5 source: Pass cmCTestResourceAllocator::Resource by value
ee1c32b6d7 source: Pass cmBuildOptions by value
fa0e5906ff source: Pass cmStringRange by value
0c4040057a source: Pass cm::string_view by value

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10948
2025-08-02 06:23:48 -04:00
Daniel Pfeifer
b1fdab3cc1 source: Pass small and trivially copyable types by value 2025-08-01 09:56:00 -04:00
Matthew Woehlke
8ac826a5f2 GenEx: Fix evaluation of $<CONFIG> on imported targets
The historic implementation of `$<CONFIG>` had some errors that could
result in multiple configurations matching. First, it always considered
the configuration of the consuming target, even if a consumed imported
target selected a different configuration. Second, it matched the entire
list of `MAP_IMPORTED_CONFIG_<CONFIG>` configurations, even if none of
those were actually selected. The latter in particular is redundant at
best, as we also consider the selected configuration of an imported
target, which is the correct configuration to match for imported
targets. Refactor the implementation so that only one configuration is
considered.

Fixes: #23660
Issue: #27022
2025-07-30 15:12:03 -04:00
Matthew Woehlke
9b36e49ad9 cmGeneratorExpressionNode: Remove dead code from ConfigurationTestNode
Commit 910ada1a88 (Genex: $<CONFIG:> syntax of all entries checked,
2023-01-17) tweaked how ConfigurationTestNode::Evaluate validates its
arguments, which resulted in the removal of the body of an `if` but not
the `if` itself. Since the condition does not have side effects, this
resulted in superfluous leftover code. Remove this.
2025-07-30 15:11:38 -04:00
Marc Chevrier
60fb5a5792 GenEx: add expressions related to linker
Introduce the following genex:
* <LANG>_COMPILER_LINKER_ID
* <LANG>_COMPILER_LINKER_FRONTEND_VARIANT

Fixes: #26991
2025-06-19 16:11:17 +02:00
Brad King
0aabf32590 cmGeneratorExpression: Constify use of cmLocalGenerator 2025-04-15 10:43:32 -04:00
Giacomo Rombaut
fe11677945 GenEx: Fix TARGET_PDB_FILE_BASE_NAME with PDB_NAME and DEBUG_POSTFIX
When `PDB_NAME` is explicitly set, the `<CONFIG>_POSTFIX` is not added
to the `.pdb` names.

Fixes: #26733
2025-03-06 11:40:59 -05: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
Brad King
f48beab388 Merge topic 'custom-transitive-properties'
77c7397ab4 Merge branch 'backport-3.31-custom-transitive-properties'
478d6cfd9a Merge branch 'backport-3.30-custom-transitive-properties'
8b5af40b34 GenEx: Fix evaluation of LINK_LIBRARIES as custom transitive property
161f703e76 GenEx: Restore evaluation context for conditional transitive properties
419c19d531 Tests: Extend CustomTransitiveProperties with custom transitive LINK_LIBRARIES
ff2004d430 Tests: Extend CustomTransitiveProperties with non-transitive LINK_LIBRARIES
d7f1a100d9 Tests: Split CustomTransitiveProperties argument checks into helper
5ac3cca63d Merge branch 'backport-3.31-custom-transitive-properties' (early part)
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10384
2025-02-24 09:15:47 -05:00
Brad King
77c7397ab4 Merge branch 'backport-3.31-custom-transitive-properties' 2025-02-23 08:36:56 -05:00
Brad King
478d6cfd9a Merge branch 'backport-3.30-custom-transitive-properties' 2025-02-23 08:33:12 -05:00
Brad King
8b5af40b34 GenEx: Fix evaluation of LINK_LIBRARIES as custom transitive property
Fix logic from commit b9ee79b8a1 (GenEx: Add support for custom
transitive compile properties, 2024-05-09, v3.30.0-rc1~82^2~1) to more
precisely know when we are computing the link dependency graph.

Issue: #20416
Issue: #26709
2025-02-23 08:30:42 -05:00
Brad King
5ac3cca63d Merge branch 'backport-3.31-custom-transitive-properties' (early part) 2025-02-22 09:41:13 -05:00
Brad King
2ccbad90e6 cmGeneratorExpressionDAGChecker: Construct with initializer list syntax 2025-02-22 09:11:20 -05:00
Brad King
99fee5720d cmGeneratorExpressionDAGChecker: De-duplicate constructor signature 2025-02-22 08:46:44 -05:00
Brad King
82151ea289 cmGeneratorExpressionDAGChecker: Construct with initializer list syntax 2025-02-22 08:33:20 -05:00
Nikita Nemkin
5d039f3be3 regex: Match ^ at most once in repeated searches
When doing successive matches, track the input start and current search
start positions separately to prevent the `^` anchor from matching in
the middle of the string.  Add policy CMP0186 to provide compatibility.

Issue: #26629
Fixes: #16899
2025-02-13 20:00:02 +05:00
Alex Turbov
d34971f455 Refactor: Eliminate redundant std::to_string as arg of cmStrCat
Plus optimize some other string operations in the modified files.
2025-01-26 04:03:38 +04:00
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
9094eaa778 CMP0044: Remove support for OLD behavior 2025-01-19 09:41:02 -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
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
Timothy Finnegan
427be46424 GenEx $<PATH>: Add NATIVE_PATH sub-command.
Implements the generator expression $<PATH:MATIVE_PATH> which convert
path(s) into a native format with platform-specific slashes (``\`` on
Windows hosts and ``/`` elsewhere).

Fixes: #26515
2024-12-14 11:16:47 +01:00
Brad King
e75067ce6f Merge topic 'aix-archive-shared-libraries-genex'
f923463f2b AIX: Disallow TARGET_SONAME_* genex for AIX_SHARED_LIBRARY_ARCHIVE targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10028
2024-11-22 12:31:00 -05:00
Brad King
f923463f2b AIX: Disallow TARGET_SONAME_* genex for AIX_SHARED_LIBRARY_ARCHIVE targets
AIX shared library archives have no filesystem artifact named with their
SONAME because it is in an archive.
2024-11-21 18:44:25 -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
9a28b0654f cmGeneratorExpressionNode: Clarify constant in unreachable code path 2024-11-13 09:38:24 -05:00
Brad King
7605228f5e codespell: Fix typos 2024-10-25 08:43:04 -04:00
Michael Herwig
4a11772618 GenEx: Limit TARGET_PROPERTY transitive closure optimization to subgraphs
Fixes: #25728
2024-09-10 13:24:24 +02:00