Commit Graph

139 Commits

Author SHA1 Message Date
Taylor Sasser dcadde3662 CPS: Refactor ForbidGeneratorExpressions into cmGeneratorExpression 2025-12-16 16:18:13 -05:00
AJIOB fe173b68f0 Source: Use cmStrCat in place of string addition 2025-12-09 11:06:59 -05:00
Marc Chevrier ab60f1a010 Extend usage for cm::string_view for more flexibility 2025-11-14 16:44:29 +01:00
Brad King 1538875ba3 Merge topic 'collect-genex-fix'
6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11322
2025-10-20 13:42:53 -04:00
Martin Duffy 6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex
Since commit 13c7bb5b0c (cmGeneratorExpression: Update strip function to
collect parsed expressions, 2025-04-08, v4.1.0-rc1~361^2~1), the logic
to strip generator expressions would error if the stripped expressions
were being collected and an expression without a `:` was found inside an
expression with a `:`. This resulted in an error when exporting a target
that contained such a generator expression in its link libraries or
compile definitions.

Address the error by checking whether the latest `$<` proceeded the
latest `:`.
2025-10-17 11:34:43 -04: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 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 d4d204382f GenEx: Collect evaluation arguments into local Context structures 2025-09-21 20:17:16 -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
Brad King 1fa7bd1965 Merge topic 'genex-strip-nested'
8227028e49 string(GENEX_STRIP): Fix regression on nested generator expressions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11077
2025-08-14 09:20:09 -04:00
Martin Duffy 8227028e49 string(GENEX_STRIP): Fix regression on nested generator expressions
Since commit 13c7bb5b0c (cmGeneratorExpression: Update strip function to
collect parsed expressions, 2025-04-08), the logic to strip generator
expressions from a string made incorrect assumptions about the contents of
generator expressions, leading certain cases to be stripped incorrectly.

Clean up the logic and fix broken behavior, and add test coverage with
`string(GENEX_STRIP)`.

Fixes: #27133
2025-08-13 15:52:16 -04:00
Daniel Pfeifer 0c4040057a source: Pass cm::string_view by value 2025-07-30 11:55:33 -04:00
Brad King 0aabf32590 cmGeneratorExpression: Constify use of cmLocalGenerator 2025-04-15 10:43:32 -04:00
Martin Duffy 13c7bb5b0c cmGeneratorExpression: Update strip function to collect parsed expressions 2025-04-11 10:54:20 -04: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 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
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
Craig Scott 5a8a6dfe81 cmGeneratorExpression: Change Find() parameter type to cm::string_view 2024-09-18 08:39:59 +10:00
Matthew Woehlke 8178fd43e9 export: Fix handling of import prefix
Fix some additional places in export generation logic that were still
hard-coding the import prefix. Change cmGeneratorExpression::Preprocess
to take the desired prefix as an argument. (This replaces taking a
boolean whether to resolve relative paths; if a non-empty prefix is
given, that is used to resolve relative paths, otherwise relative paths
are left alone.) This should ensure that import properties always spell
the prefix according to the format being generated.
2024-07-26 16:40:03 -04:00
Brad King 633afa0b2e cmGeneratorExpressionDAGChecker: Make config name available in constructor 2024-05-21 09:22:51 -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 5f7d8192da cmGeneratorExpression: Inline evaluation helper at only call site 2024-04-12 12:23:59 -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
Kyle Edwards 830eed374d CMake: fix sizeof string literal violations 2022-11-18 09:37:58 -05:00
Kyle Edwards 38cbf5e15b Genex: Add $<BUILD_LOCAL_INTERFACE:...> genex
Fixes: #23209
2022-11-17 09:31:27 -05:00
Kyle Edwards 37b5c78688 cmGeneratorExpression: Refactor stripExportInterface() to use enum class 2022-11-17 09:31:27 -05:00
Kyle Edwards 4d70a94545 Profiling: Profile genex evaluation 2022-11-11 12:29:41 -05:00
Kyle Edwards 09d7f947d6 cmGeneratorExpression: Require cmake instance 2022-11-11 12:29:41 -05:00
Ben Boeckel a5f8cbe8b1 clang-tidy: address modernize-use-default-member-init lints 2022-05-24 09:09:43 -04:00
Vitaly Stakhovsky 43f7b17816 cmGeneratorExpressionInterpreter::Evaluate: remove const char* overload 2020-07-11 11:51:22 -04:00
Vitaly Stakhovsky b0dc52704b cmGeneratorExpression: remove const char* overloads 2020-03-08 17:22:43 -04:00
Marc Chevrier 461efa7b51 Genex: Add $<LINK_LANGUAGE:...> and $<LINK_LANG_AND_ID:...>
This MR may help to solve issues #19757 and #18008

Fixes: #19965
2020-02-26 16:38:42 +01:00
Marc Chevrier d74416a9cd cmGeneratorExpressionEvaluator: Modernize memory management 2019-12-05 17:20:56 +01:00
Kyle Edwards 2ec1156b80 Refactor: Generalize cmExportInstallFileGenerator::ReplaceInstallPrefix() 2019-11-01 17:29:37 -04:00
Kitware Robot ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Daniel Eiband 7dcf9cb83c cmGeneratorExpression: Add cmGeneratorExpression::Evaluate utility
cmGeneratorExpression::Evaluate is a shortcut when only the evaluated string is
needed or an instance of cmCompiledGeneratorExpression cannot be cached.

Fixes: #19686
2019-09-23 21:19:15 +02:00
Daniel Eiband c12222db86 cmGeneratorExpression: Remove Evaluate overload by parameter re-ordering
Simplify by re-ordering parameters of cmCompiledGeneratorExpression::Evaluate
so that frequently used parameters are before less frequently used parameters.
This allows with little extra arguments to get rid of one Evaluate overload,
which makes it easier to implement the cmGeneratorExpression::Evaluate utility.
The latter would otherwise need four overloads.
2019-09-22 09:51:19 +02:00
Daniel Eiband 1811411fec cmGeneratorExpression: Move quiet flag to cmCompiledGeneratorExpression
The quiet flag is false for all but one call to Evaluate.  Make the quiet flag
a setter of cmCompiledGeneratorExpression to be able to remove it from the
Evaluate function signature.
2019-09-22 09:49:41 +02:00
Regina Pfeifer f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Regina Pfeifer d25a5a7ec9 clang-tidy: modernize-use-auto
Set the MinTypeNameLength option to an impossibly high value in order
to limit the diagnostics to iterators.  Leave new expressions and cast
expressions for later.
2019-09-10 22:21:41 +02:00
Regina Pfeifer a1ddf2d0ba clang-tidy: Replace typedef with using
Automate the conversion with

  perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g'

then manually fix a few places.
2019-09-04 18:03:01 +02:00
Sebastian Holtermann f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Brad King 71fbebd1dc IWYU: Fix handling of <memory> standard header
An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
2019-07-10 11:48:56 -04:00
Regina Pfeifer 55671b41d2 clang-tidy: Use = default
Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and
`Source/cmUVHandlePtr.h` where a few older compilers require a
user-defined default constructor (with `{}`).
2019-01-25 06:44:32 -05:00
Regina Pfeifer 5a0784ddea clang-tidy: Pass by value 2019-01-22 13:03:04 -05:00