summaryrefslogtreecommitdiff
path: root/Source/cmCustomCommandGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-1/+1
| | | | | | | | | | * Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
* Reduce allocation of temporary values on heap.Pavel Solodovnikov2018-01-261-2/+3
| | | | | - Use `std::move` while inserting temporary results into vectors. - Change `push_back` to `emplace_back` where appropriate.
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-261-3/+4
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Merge topic 'ranged-for'Brad King2017-09-131-12/+8
|\ | | | | | | | | | | | | 7d509579 Meta: modernize old-fashioned loops to range-based `for`. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1249
| * Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-12/+8
| | | | | | | | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* | cmCustomCommandGenerator: Fix include-what-you-use diagnosticBrad King2017-09-111-0/+2
| | | | | | | | For `size_t` we should include `stddef.h`.
* | add HasOnlyEmptyCommandLines() method to cmCustomCommandGeneratorMichael Stürmer2017-09-041-0/+12
|/
* IWYU: Mark cmConfigure.h with pragma: keepDaniel Pfeifer2017-08-261-2/+0
| | | | Also remove `#include "cmConfigure.h"` from most source files.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-6/+5
|
* cmCustomCommandGenerator: Avoid mutable stateBrad King2017-08-081-19/+16
| | | | | Expand generator expressions of DEPENDS in the constructor instead of on-demand.
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-1/+1
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* add_custom_{command,target}: Add COMMAND_EXPAND_LISTS optionEd Branch2017-01-131-9/+23
| | | | | | This option allows lists generated by generator expressions to be expanded. Closes: #15935
* Fix custom command target substitution with CROSSCOMPILING_EMULATORBrad King2016-10-281-13/+32
| | | | | | | | | | | | In commit v3.6.0-rc1~88^2 (CustomCommandGenerator: Add support for CROSSCOMPILING_EMULATOR, 2016-05-04) logic was introduced to substitute a target's `CROSSCOMPILING_EMULATOR` for argv0 in a custom command. However, it broke the case when the argv0 was a target name and now fails to expand the target name to its location at the same time as inserting the emulator. Fix the latter case. Inspired-by: Brian Maher <brian@brimworks.com> Closes: #16288
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-3/+3
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-0/+7
|
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-2/+2
| | | | | | | | | | | | Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
* use CM_NULLPTRDaniel Pfeifer2016-06-281-1/+1
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-64/+47
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* CustomCommandGenerator: Add support for CROSSCOMPILING_EMULATORJean-Christophe Fillion-Robin2016-05-091-2/+32
| | | | | | Teach the `add_custom_command` and `add_custom_target' commands to substitute argv0 with the crosscompiling emulator if it is a target with the `CROSSCOMPILING_EMULATOR` property set.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>