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

268 Commits

Author SHA1 Message Date
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
Deniz Bahadir
af81b8667e GenEx: Add generator expr. for CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT 2024-05-22 16:43:33 +02: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
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
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
Brad King
b36fb3f6f1 cmGeneratorExpressionNode: Remove outdated lint suppression
Since commit 895efd4e7a (cmGeneratorExpression: Consolidate
recognition of transitive properties, 2024-04-12) a lint suppression
added by commit fb461cacba (silence selected clang-tidy violations,
2016-10-18, v3.8.0-rc1~428^2~1) is no longer needed.
2024-04-29 17:27:34 -04:00
Brad King
895efd4e7a cmGeneratorExpression: Consolidate recognition of transitive properties 2024-04-12 12:24:05 -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
Brad King
0a61116f52 cmGeneratorTarget: Remove EvaluateInterfaceProperty argument default
Pass it explicitly at the call sites.
2024-04-12 11:50:52 -04:00
Brad King
c94cfe92eb GenEx: Fix COMPATIBLE_INTERFACE_ evaluation outside usage requirements
In commit ff6c401309 (cmTarget: Add interface for compatible numeric
properties, 2013-10-22, v3.0.0-rc1~460^2) the condition

    dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()

was written that way to avoid a nullptr dereference, but is actually
meant to say "is not evaluating link libraries".  That can also be true
when there is no `dagCheckerParent`, such as when evaluating a generator
expression outside of usage requirements, e.g., for `add_custom_target`.
The original commit tried to account for that by duplicating the
implementation in another code path, but that did not work in all cases.

Fix the condition, remove the duplication, and enable tests for the
now-working cases.
2024-04-11 18:35:40 -04:00
Brad King
061f7a6b97 GenEx: Remove redundant condition in COMPATIBLE_INTERFACE_ evaluation
The `IsLinkInterfaceDependent*Property` methods internally exclude
INTERFACE libraries since commit 0bfcb450e6 (INTERFACE_LIBRARY: Avoid
codepaths which set unneeded properties., 2013-11-20, v3.0.0-rc1~301^2~1).
2024-04-11 18:34:47 -04:00
Brad King
86f99c5f6d GenEx: Add COMPATIBLE_INTERFACE_ implementation comments 2024-04-11 18:34:47 -04:00
Brad King
541a788264 Tests: Add COMPATIBLE_INTERFACE_ cases outside usage requirements 2024-04-11 18:34:19 -04:00
Robert Maynard
879690ba14
GeneratorExpression: Add $<QUOTE> generator expression
Support inserting '"' literals in generator expressions

Fixes #20869
2024-02-14 14:23:18 -05:00
Martin Duffy
27244a8f73 cmGeneratorExpressionNode: Fix short-circuit logic
Fix logic added by commit 634079b86d (cmGeneratorExpressionEvaluator:
Short-circuit boolean operators, 2023-09-11, v3.28.0-rc1~47^2) and
add missing test cases.

Fixes: #25412
2023-11-13 11:11:18 -05:00
Brad King
b8151299de Merge topic 'genexp-no-eval'
634079b86d cmGeneratorExpressionEvaluator: Short-circuit boolean operators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Acked-by: Pavel Solodovnikov <hellyeahdominate@gmail.com>
Merge-request: !8791
2023-09-26 09:31:42 -04:00
Martin Duffy
634079b86d cmGeneratorExpressionEvaluator: Short-circuit boolean operators 2023-09-13 18:01:14 -04:00
Brad King
4ee45988cb Merge topic 'cmList-INSERT-regression'
45ed175f08 list(INSERT): restore old behavior

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8732
2023-08-19 08:37:09 -04:00
Marc Chevrier
45ed175f08 list(INSERT): restore old behavior
Fixes: #25191
2023-08-17 12:07:41 +02:00
Brad King
a0056a96d5 Merge topic 'genex-REMOVE_DUPLICATES-empty'
861dd60ecf Genex: Restore REMOVE_DUPLICATES preservation of empty elements

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8623
2023-07-13 08:34:22 -04:00
Brad King
861dd60ecf Genex: Restore REMOVE_DUPLICATES preservation of empty elements
Refactoring in commit 72d116ee68 (GenEx: list oriented genexes use
cmList class, 2023-03-29, v3.27.0-rc1~205^2) accidentally caused
empty elements to be dropped by the `REMOVE_DUPLICATES` genex.
Fix it and add a test case.

Fixes: #25080
2023-07-12 11:49:21 -04:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Brad King
5924630e6d Merge topic 'compile-only-genex'
c42630ee62 cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex
0fb923c460 cmGeneratorExpressionNode: implement `COMPILE_ONLY` genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8411
2023-05-05 12:42:23 -04:00
Robert Maynard
c42630ee62 cmGeneratorExpressionNode: implement COMPILE_ONLY genex
This generator expression is the inverse of `LINK_ONLY` and only coveys
usage requirements for the purposes of compilation. Its intended use is
to avoid needing to export targets that do not have link usage
requirements (e.g., header-only libraries) when used by another target.

See: #15415
2023-05-04 09:39:06 -04:00
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Marc Chevrier
87fe031a07 cmList class: various enhancements 2023-04-29 09:54:22 +02: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
31675964e7 GenEx LIST: list operations
Fixes: #24550, #24547
2023-04-16 12:00:20 +02:00
Ben Boeckel
0fb923c460 cmGeneratorExpressionNode: implement COMPILE_ONLY genex
This generator expression is the inverse of `LINK_ONLY` and only coveys
usage requirements for the purposes of compilation. Its intended use is
to avoid needing to export targets that do not have link usage
requirements (e.g., header-only libraries) when used by another target.

It will also be used to represent private usage requirements on exported
C++ module-containing targets in the future.

Eventually there should be logic to collapse nesting of
`$<COMPILE_ONLY>` and `$<LINK_ONLY>` when generating instances of
either. A TODO is left in the code for this case.

See: #15415
2023-04-12 10:43:48 -04:00
Marc Chevrier
72d116ee68 GenEx: list oriented genexes use cmList class
Fixes: #24654
2023-04-05 17:55:04 +02:00
Kyle Edwards
def618f1ae Merge topic 'TargetRunTimeDllDirs'
a2c9c4f202 Add test for the new TARGET_RUNTIME_DLL_PATHS genex
aa68de0a27 TARGET_RUNTIME_DLLS: minor refactoring of shared-check.cmake
2ce3d62ffb Help: add documentation for the new TARGET_RUNTIME_DLL_DIRS genex
c351dcd967 TARGET_RUNTIME_DLL_DIRS: add the new genex to cmGeneratorExpressionNode
064c3244da TARGET_RUNTIME_DLLS: fix test for this genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !8247
2023-03-02 16:28:30 -05: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
Alexander Neundorf
c351dcd967 TARGET_RUNTIME_DLL_DIRS: add the new genex to cmGeneratorExpressionNode
This commit adds handling for a new genex TARGET_RUNTIME_DLL_DIRS to
cmGeneratorExpressionNode. It refactors the code for TARGET_RUNTIME_DLLS
a bit, so that both TARGET_RUNTIME_DLL_DIRS and TARGET_RUNTIME_DLLS
share the implementation to collect all dlls. The new genex
collects the dlls and in a final step puts all the directories
into the result variable (and makes sure there are no duplicates).
2023-02-26 16:33:16 +01:00
Marc Chevrier
e395310a21 PATH-genex: handle lists for path decomposition and transformations
Fixes: #24371
2023-02-21 19:34:43 +01:00
Neal Venditto
780b279cc6 GHS: Enable language-dependent generator expressions
Add `Green Hills MULTI` to the list of generators checked for the
`COMPILE_LANGUAGE`, `COMPILE_LANG_AND_ID`, `LINK_LANGUAGE`, and
`LINK_LANG_AND_ID` generator expressions, since these are supported by
the generator.

Fixes: #24262
2023-02-17 19:07:37 -05:00