1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-10 16:21:40 +08:00

65 Commits

Author SHA1 Message Date
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Brad King
68e5f92cad cmGlobalNinjaGenerator: Factor out custom command output collection
De-duplicate code paths calling ConvertToNinjaPath and
SeenCustomCommandOutput on custom command outputs and custom target
byproducts.
2021-05-19 12:07:58 -04:00
Brad King
c5195193d3 cmGlobalNinjaGenerator: Reduce string copies in WriteCustomCommandBuild
Re-order arguments to group those with similar roles.
Use move semantics to avoid copying vectors of strings.
2021-05-19 12:07:58 -04:00
Kyle Edwards
ad08f93ee4 Ninja Multi-Config: Split long command lines by config
Fixes: #22123
2021-04-30 14:46:21 -04:00
Kyle Edwards
f8e2a74712 Ninja Multi-Config: Correctly generate POST_BUILD custom targets
Fixes: #22096
2021-04-22 15:51:53 -04:00
Brad King
ccbedb80e4 Ninja Multi-Config: Restore rebuild_cache and edit_cache targets
Since commit dcf9f4d2f7 (Ninja Multi-Config: Add support for
cross-config custom commands, 2020-12-09) we were not generating these
targets.  Restore them and add a test.

Fixes: #21722
2021-01-25 15:22:53 -05:00
Brad King
6fdbe9201f cmNinjaUtilityTargetGenerator: Remove leftover development comment 2021-01-25 15:11:48 -05:00
Oleksandr Koval
209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Kyle Edwards
dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands
Co-Author: Brad King <brad.king@kitware.com>
2020-12-15 07:01:21 -05:00
Kyle Edwards
2a6471dd7b Merge branch 'master' into ninja-multi-automoc-regression 2020-09-02 14:39:04 -04:00
Kyle Edwards
f1199bdc96 Ninja Multi-Config: Fix cleaning of utility targets with commands 2020-09-02 12:59:59 -04:00
Kyle Edwards
cfe2dc4721 Ninja: Remove parameter default for cmNinjaTargetDepends 2020-07-24 11:49:59 -04:00
Vitaly Stakhovsky
b36d1bdd9d Single location for cmProp typedef 2020-06-01 08:54:20 -04:00
Brad King
99ab9212f0 Merge topic 'ninja-multi-install'
dddb4f02f7 Ninja Multi-Config: Make "install" targets depend on default configs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4778
2020-05-25 10:33:26 -04:00
Kyle Edwards
dddb4f02f7 Ninja Multi-Config: Make "install" targets depend on default configs
And add an "install:all" target.

Fixes: #20713
2020-05-22 13:15:50 -04:00
Vitaly Stakhovsky
36aba01223 cmGeneratorTarget::GetProperty: return cmProp 2020-04-29 10:59:39 -04:00
Kyle Edwards
110037369d Refactor: Split Ninja files into impl-<Config>.ninja and build-<Config>.ninja 2020-01-22 10:26:21 -05:00
Kyle Edwards
5a8a9f7229 Ninja: Add multi-config variant
Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
2019-12-13 10:51:46 -05:00
Kyle Edwards
3bc63e99e4 Refactor: Prepare Ninja generator for multi-config 2019-12-13 10:51:46 -05: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
Brad King
2a2c4cc722 Merge topic 'ninja_additional_clean_files_custom_target'
d040f3f1ee Tests: Extend MakeClean test to test various target types
3ed8cffe73 Ninja: Add support for ADDITIONAL_CLEAN_FILES in custom targets

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3739
2019-08-27 10:16:05 -04:00
Sebastian Holtermann
3ed8cffe73 Ninja: Add support for ADDITIONAL_CLEAN_FILES in custom targets
This enables the support for `ADDITIONAL_CLEAN_FILES` in custom targets
using the ninja generator.

Fixes: #19641
2019-08-26 09:31:03 -04:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
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)`
2019-08-22 16:38:10 +02:00
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Rolf Eike Beer
da26b3be89 avoid adding multiple consecutive string literals to std::string
While at it change some single character additions to be of type char.
2019-08-18 14:22:11 +02:00
Sebastian Holtermann
0d0cb136fb Ninja: Use cmNinjaBuild instead of WritePhonyBuild 2019-05-30 18:38:14 +02:00
Sebastian Holtermann
09c21914b3 Ninja: Embrace temporary objects in scopes 2019-05-30 18:21:40 +02:00
Rosen Matev
9f76961de8 Support job pools in custom commands and targets
Provide a way for custom commands and targets to set the pool variable
of the ninja build statement. Setting `JOB_POOL` is not compatible with
`USES_TERMINAL`, which implies the `console` pool.

The option is silently ignored with other generators.

Closes: #18483
2019-05-14 15:58:00 +02:00
Brad King
d75fec5a88 Merge topic 'tidy-use-equals-default'
094f01d0f0 cleanup: Prefer compiler provided special member functions
55671b41d2 clang-tidy: Use `= default`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !2841
2019-01-29 14:07:24 -05: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
Bruno Manganelli
3e867ed400 cmake: inlined files dir constant and removed it from cmake.h 2019-01-21 15:34:16 +00:00
Roger Leigh
22e8b3af04 Ninja: Generate scripts for long custom command sequences
Ninja runs just one command line for every build statement, so the Ninja
generator needs to `&&`-chain multiple commands together into one long
string.  For long custom command sequences this can exceed the maximum
command-line length for the operating system.  In such cases, write the
commands out to a script instead, and then run the script from Ninja's
one command line.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #15612
2018-02-06 13:24:46 -05:00
Pavel Solodovnikov
7d5095796a Meta: modernize old-fashioned loops to range-based for.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
2017-09-12 16:22:47 +03:00
Stephen Kelly
a91eaf3872 cmState: Port dependents to new cmStateTypes header 2016-10-19 15:40:59 +02:00
Stephen Kelly
a49751fb2e cmState: Move TargetType enum to separate namespace 2016-10-19 15:40:58 +02:00
Brad King
86578eccf2 Simplify CMake per-source license notices
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.
2016-09-27 15:14:44 -04:00
Kulla Christoph
048d1adb4e add_custom_command: Add DEPFILE option for Ninja
Provide a way for custom commands to inform the ninja build tool about
their implicit dependencies.  For now simply make use of the option an
error on other generators.

Closes: #15479
2016-08-30 09:05:18 -04:00
Daniel Pfeifer
5cbb548807 fix a batch of include-what-you-use violations 2016-08-24 00:29:15 +02:00
Brad King
0278989405 Ninja: Add $subdir/{test,install,package} targets
With the Makefile generator one can use `cd $subdir; make install` to build and
install targets associated with a given subdirectory.  This is not possible to
do with the Ninja generator since there is only one `build.ninja` file at the
top of the build tree.  However, we can approximate it by allowing one to run
`ninja $subdir/install` at the top of the tree to build the targets in the
corresponding subdirectory and install them.

This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets.
It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add
`$subdir/all` targets, 2016-03-11).
2016-08-09 15:15:24 -04:00
Daniel Pfeifer
a16bf141bc Add missing braces around statements.
Apply fixits of clang-tidy's readability-braces-around-statements
checker.
2016-06-10 18:36:24 +02:00
Daniel Pfeifer
25d1ef6424 Use enums defined in cmOutputConverter using their fully qualified name.
Mostly automated:

values=("RelativeRoot" "NONE" "FULL" "HOME" "START" "HOME_OUTPUT" "START_OUTPUT"
        "OutputFormat" "UNCHANGED" "MAKERULE" "SHELL" "WATCOMQUOTE" "RESPONSE"
        "FortranFormat" "FortranFormatNone" "FortranFormatFixed" "FortranFormatFree")
for i in "${values[@]}"; do git grep -l cmLocalGenerator::$i | xargs sed -i "s|cmLocalGenerator::$i|cmOutputConverter::$i|g"; done
2016-05-25 09:20:09 -04:00
Nicolas Despres
038e7716e5 Ninja: Pass all build paths through a central method
This gives us a central location to revise paths.
2016-05-17 09:34:11 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
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.
2016-05-16 16:05:19 -04:00
Brad King
e1c7747253 Format include directive blocks and ordering with clang-format
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>
2016-04-29 13:58:54 -04:00
Brad King
180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Brad King
7d64a0598d Ninja: Add 'restat' parameter to custom command generation method
Pass 'true' from all call sites to preserve existing behavior.
2015-11-19 15:11:00 -05:00
Stephen Kelly
3f8aa62bfb cmGeneratorTarget: Add API for target-relative commands. 2015-10-26 22:02:13 +01:00
Stephen Kelly
80de856bb5 Ninja: Port to cmGeneratorTarget. 2015-10-24 09:19:53 +02:00
Stephen Kelly
cfb2f7508a Use cmGeneratorTarget for property access. 2015-10-17 17:30:38 +02:00
Stephen Kelly
12cb3bdce4 cmLocalGenerator: Add Home directory accessors.
Reduce reasons for cmLocalGenerator to have a cmMakefile.
2015-10-09 00:00:19 +02:00