summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* add_custom_{command,target}: add genex support for COMMENTPeter Würth2022-11-191-3/+18
| | | | | | | | | | Evaluate and expand generator expressions in the `COMMENT` argument of the `add_custom_command()` and `add_custom_target()` commands. This allows to include generator expressions, e.g. a targets location $<TARGET_...> or the current configuration $<CONFIG>, in the build-time messages. Fixes #22507
* cmCustomCommandGenerator: refactor GetComment to return std::stringPeter Würth2022-11-191-2/+5
| | | | Refactoring was done because EvaluateComment leaked memory.
* cmGeneratorExpression: Require cmake instanceKyle Edwards2022-11-111-2/+3
|
* Merge topic 'nmc-cross-config-target-deps'Brad King2021-11-051-4/+8
|\ | | | | | | | | | | | | | | | | | | 95f44e00cd Ninja Multi-Config: Fix custom command target dependencies in cross-configs a883363935 Ninja Multi-Config: Fix internal cross-config target dependency ordering 16e24748c5 Ninja Multi-Config: Fix cross-config custom command dependency tracing Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6702
| * Ninja Multi-Config: Fix custom command target dependencies in cross-configsBrad King2021-11-041-4/+8
| | | | | | | | | | | | | | | | | | | | | | Generator expressions in a non-cross custom command's `COMMAND` arguments are evaluated in the command config. Target-level dependencies implied by `TARGET_FILE` must therefore be cross dependencies. This is important to generate proper target-level dependencies on the cross-config build statements for the target to which the custom command is attached. Fixes: #22855
* | Source: fix many -Wmissing-prototypes warnings by marking functions staticSean McBride2021-10-251-1/+1
|/
* Rename cmProp in cmValueMarc Chevrier2021-09-211-2/+2
|
* cmTransformDepfile: Add support for MSBuild AdditionalInputs formatBrad King2021-06-091-0/+6
|
* cmake_transform_depfile: Remove unused incomplete vstlog supportBrad King2021-06-021-6/+0
| | | | | | | | | | | | | | | In commit b2c14bc774 (cmake -E: Add cmake_transform_depfile internal command, 2020-10-02, v3.20.0-rc1~684^2~2) a partial implementation for converting MSBuild "TLog" format files was added. However, it is unused and incomplete: * Does not enforce absolute paths as TLog docs require. * Does not upper-case paths as TLog docs recommend. * The TLog format semantics are not equivalent to `out: in`. Remove the unused TLog transform infrastructure to avoid confusion. Issue: #20286
* add_custom_command: Target-dependent generator expression supportRaul Tambre2021-05-311-7/+11
| | | | | | | | | OUTPUT variant with a TARGET given to allow resolving target-based generator expressions wouldn't work because OUTPUT is resolved before generator targets are created, i.e. FindGeneratorTargetToUse() returns nullptr. This is a known limitation, see #21364. Implements #21336.
* Xcode: Add support of DEPFILE for add_custom_command, part 2Marc Chevrier2021-04-171-0/+4
| | | | | | This MR extend the support of 'DEPFILE' to buildsystem version 1. Issue: #20286
* Xcode: Add support of DEPFILE for add_custom_commandMarc Chevrier2021-04-151-7/+23
| | | | Issue: #20286
* Genex: add_custom_command: DEPFILE supports genexMarc Chevrier2021-04-121-1/+20
| | | | | | This facility is very useful for 'Ninja Multi-Config' and required as well for future support of DEPFILE in 'Xcode' and 'Visual Studio' generators (#20286).
* Ninja: add_custom_command(DEPFILE): Ensure dependencies consistencyMarc Chevrier2021-01-191-9/+5
| | | | Fixes: #21694
* Ninja Multi-Config: Add support for cross-config custom commandsKyle Edwards2020-12-151-22/+110
| | | | Co-Author: Brad King <brad.king@kitware.com>
* cmLocalGenerator: Factor out helper to expand custom command output pathsBrad King2020-12-101-5/+1
|
* cmCustomCommandGenerator: Treat relative outputs w.r.t. build dirBrad King2020-12-101-11/+28
| | | | | | The `add_custom_command` and `add_custom_target` commands already do this for plain output and byproduct paths. Perform the same conversion for such paths discovered after generator expression evaluation too.
* cmCustomCommandGenerator: Refactor OUTPUT and DEPENDS path evaluationBrad King2020-12-101-17/+20
| | | | | | * Use value semantics. * Normalize paths in a separate loop. * If CollapseFullPath is used, ConvertToUnixSlashes is unnecessary.
* cmCustomCommandGenerator: Evaluate generator expressions in outputsBrad King2020-12-101-1/+2
| | | | | | | | | | This was already done for byproducts by commit a583b7bc17 (Genex: Evaluate byproduct generator expressions in cmCustomCommandGenerator, 2019-09-11, v3.16.0-rc1~86^2). Like that commit, this does not actually expose the feature to projects because the front-end commands still reject generator expressions. Issue: #12877
* cmCustomCommandGenerator: Collect genex target references in commandsBrad King2020-10-291-4/+22
| | | | These will become target-level dependencies.
* cmCustomCommandGenerator: Add move operationsBrad King2020-10-271-7/+7
|
* Remove unnecessary arbitrary CollapseFullPath second argumentsBrad King2020-10-271-2/+1
| | | | | | | | | | Some calls to CollapseFullPath that already have an absolute path were updated by commit 22f38c0d6b (cmake: avoid getcwd in `CollapseFullPath`, 2020-01-14, v3.17.0-rc1~171^2) to pass an arbitrary second argument to prevent unnecessary `getcwd` calls. Since then, the KWSys implementation of CollapseFullPath has learned to avoid unnecessary `getcwd` calls on its own, so we can drop the arbitrary second arguments to our CollapseFullPath calls.
* cmCustomCommandGenerator: Add option to transform depfileKyle Edwards2020-10-131-2/+71
|
* Single location for cmProp typedefVitaly Stakhovsky2020-06-011-0/+1
|
* cmGeneratorTarget::GetProperty: return cmPropVitaly Stakhovsky2020-04-291-2/+2
|
* Source: use std::string in place of const char*Vitaly Stakhovsky2020-01-291-1/+1
|
* add_custom_command: check if a relative path should be an in-source pathBen Boeckel2020-01-161-4/+0
| | | | | | | | This still is broken for dependencies on generated paths where they get generated to the source directory rather than the build directory however, but there's no way to determine that is the case. Fixes: #20194
* cmake: avoid getcwd in `CollapseFullPath`Tim Blechmann2020-01-141-1/+2
| | | | | | `CollapseFullPath` calls getcwd, which is a rather expensive system call. we can replace it with `GetHomeOutputDirectory()` to save us from the calling overhead
* add_custom_command: convert DEPENDS path arguments to absolute pathsBen Boeckel2019-12-181-0/+4
| | | | | | | This is only done if they are "obviously" paths in that they contain a directory separator. Fixes: #17111
* Refactoring: use append functions from cmext/algorithmMarc Chevrier2019-12-171-3/+4
|
* Ninja: Add multi-config variantKyle Edwards2019-12-131-2/+6
| | | | Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-4/+4
| | | | | 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.
* cmCustomCommandGenerator: Replace generator expression memberDaniel Eiband2019-09-221-13/+7
| | | | | Replace generator expression member variable by stack variable in the constructor.
* Genex: Evaluate byproduct generator expressions in cmCustomCommandGeneratorDaniel Eiband2019-09-171-1/+3
| | | | | | | | | | | Evaluate and expand generator expressions in byproducts of custom commands. Note that it is still not possible to use generator expressions in byproducts of the commands `add_custom_command` and `add_custom_target`. These commands still reject the input. This is a preparation step for OUTPUT generator expression support. Issue: #12877
* Genex: Move genex expansion of paths into AppendPaths utilityDaniel Eiband2019-09-171-14/+23
| | | | | | | Refactored internals of cmCustomCommandGenerator to make processing of path lists (evaluation of generator expressions and expansion into a list) available as AppendPaths utility function to be used for byproduct generator expression support.
* Merge topic 'tidy-deprecated-headers'Brad King2019-09-161-1/+1
|\ | | | | | | | | | | | | f30523d090 clang-tidy: modernize-deprecated-headers Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3792
| * clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-1/+1
| |
* | add_custom_command: Delay slash conversion until after genex evaluationSebastian Lipponer2019-09-131-0/+1
|/ | | | | | Generator expressions may contain or produce backslashes. Fixes: #19553
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is generated by a python script that uses regular expressions to search for string concatenation patterns of the kind ``` std::string str = <ARG0>; str += <ARG1>; str += <ARG2>; ... ``` and replaces them with a single `cmStrCat` call ``` std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...); ``` If any `<ARGX>` is itself a concatenated string of the kind ``` a + b + c + ...; ``` then `<ARGX>` is split into multiple arguments for the `cmStrCat` call. If there's a sequence of literals in the `<ARGX>`, then all literals in the sequence are concatenated and merged into a single literal argument for the `cmStrCat` call. Single character strings are converted to single char arguments for the `cmStrCat` call. `std::to_string(...)` wrappings are removed from `cmStrCat` arguments, because it supports numeric types as well as string types. `arg.substr(x)` arguments to `cmStrCat` are replaced with `cm::string_view(arg).substr(x)`
* Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgumentSebastian Holtermann2019-08-141-5/+5
|
* Merge topic 'fix-emulator-arguments'Brad King2019-07-241-1/+1
|\ | | | | | | | | | | | | bf6f5467a0 Fix allocation in CROSSCOMPILING_EMULATOR evaluation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3591
| * Fix allocation in CROSSCOMPILING_EMULATOR evaluationMarek Antoniak2019-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In commit fec441ec17 (Teach CROSSCOMPILING_EMULATOR to support arguments, 2019-05-30, v3.15.0-rc1~6^2) the new member `cmCustomCommandGenerator::EmulatorsWithArguments` was not initialized to the proper size. Fix this and add a test case covering the crash that could occur with multiple commands where an emulator appears only in a later command. Fixes: #19500 Co-Author: Brad King <brad.king@kitware.com>
* | IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-1/+1
|/ | | | | | | | 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.
* Teach CROSSCOMPILING_EMULATOR to support argumentsMarek Antoniak2019-06-031-12/+45
| | | | Fixes: #19321
* Use cmAppend to append ranges to std::vector instancesSebastian Holtermann2019-05-231-7/+5
|
* clang-tidy: Pass by valueRegina Pfeifer2019-01-221-2/+2
|
* add_custom_{command,target}: Fix WORKING_DIRECTORY leading genexBrad King2018-11-031-0/+6
| | | | | | | | | | | Since commit v3.13.0-rc1~39^2 (add_custom_{command,target}: WORKING_DIRECTORY generator expressions, 2018-09-22) the `WORKING_DIRECTORY` option accepts generator expressions. Fix support for the case of a leading generator expression by deferring conversion to an absolute path until after evaluation of the generator expression. Fixes: #18543
* add_custom_{command,target}: WORKING_DIRECTORY generator expressionsJon Chronopoulos2018-09-281-1/+8
| | | | | | | This teaches add_custom_command and add_custom_target WORKING_DIRECTORY about generator expressions Fixes: #14089
* add_custom_{command,target}: Fix crash on empty expanded commandBrad King2018-05-141-0/+8
| | | | | | | | | | | Our custom command generation logic assumes that all command lines have at least `argv0`. In `add_custom_{command,target}` we already check that at least a `COMMAND` was given, but using `COMMAND_EXPAND_LISTS` in combination with a generator expression that expands to an empty string may produce an empty command line. In this case simply add an empty string as a command to maintain our internal invariant. Fixes: #17993
* cmCustomCommandGenerator: Simplify cmOutputConverter accessBrad King2018-02-011-3/+1
| | | | | | | | | | In commit v3.4.0-rc1~480^2~3 (cmCustomCommandGenerator: Port to cmOutputConverter, 2015-06-04), cmCustomCommandGenerator's access to the local generator was removed so it needed to construct its own cmOutputConverter instance. Access to the local generator was then restored by commit v3.4.0-rc1~285^2~21 (cmCustomCommandGenerator: Require cmLocalGenerator in API, 2015-07-25), so now we can use its cmOutputConverter base class methods directly.