Commit Graph

793 Commits

Author SHA1 Message Date
Daniel Eiband
777ceaea94 cmMakefile: Delay custom command creation
Move custom command creation to cmLocalGenerator and dispatch custom
commands in cmMakefile to generate time.  Generators add custom commands
using the new methods provided by cmLocalGenerator.

Issue: #12877
2019-11-24 20:32:43 +01:00
Daniel Eiband
96e5042e46 cmCustomCommand: Explicitly pass backtrace on construction 2019-11-24 20:13:23 +01:00
Brad King
51d83d4955 Merge topic 'xcode-objc'
1e68fb0c91 Xcode: Set source file type for Objective C/C++

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4073
2019-11-21 11:27:25 -05:00
Brad King
1e68fb0c91 Xcode: Set source file type for Objective C/C++
Fixes: #19998
2019-11-20 09:43:00 -05:00
Gregor Jasny
92c4c852db Xcode: Add custom working directory property
Closes: #19967
2019-11-18 22:34:34 +01:00
Brad King
ccd2c2824a Merge topic 'modernize-memory-management'
f93385283f cmLocalGenerator: modernize memory management
101b5288ff cmAlgorithm: Extend cmAppend capabilities

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4028
2019-11-12 09:55:20 -05:00
Brad King
5b46bc3194 Merge topic 'unity-HEADER_FILE_ONLY'
9a5418320e Unity: Don't include sources with HEADER_FILE_ONLY property set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4023
2019-11-12 09:51:16 -05:00
Brad King
eae743bf17 Merge topic 'unity-HEADER_FILE_ONLY' into release-3.16
9a5418320e Unity: Don't include sources with HEADER_FILE_ONLY property set

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4023
2019-11-12 09:51:15 -05:00
Brad King
43ef704d51 Merge topic 'objc-xcode-flags'
bb42e1ed43 ObjC: Add OBJC/OBJCXX flags to Xcode projects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4020
2019-11-12 09:43:11 -05:00
Cristian Adam
bb42e1ed43 ObjC: Add OBJC/OBJCXX flags to Xcode projects
Fixes: #19936
2019-11-11 17:43:17 +01:00
Marc Chevrier
f93385283f cmLocalGenerator: modernize memory management 2019-11-11 16:41:13 +01:00
Cristian Adam
9a5418320e Unity: Don't include sources with HEADER_FILE_ONLY property set
Fixes: #19946
Fixes: #19947
Co-authored-by: Craig Scott <craig.scott@crascit.com>
2019-11-11 14:10:18 +01:00
Brad King
30908fa0ee Merge topic 'xcode-restore-CMakeLists'
0ce8a5c08d Xcode: Fix generated references to CMakeLists.txt files
9457c95aa0 cmGlobalXCodeGenerator: Mark known source locations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3999
2019-11-06 09:23:56 -05:00
Brad King
0ce8a5c08d Xcode: Fix generated references to CMakeLists.txt files
Refactoring in commit 2d888e3390 (cmSourceFile: Rename mutating
GetFullPath() overload, 2019-08-29, v3.16.0-rc1~160^2) accidentally left
the paths to `CMakeLists.txt` files empty in generated Xcode project
files.

Fixes: #19927
2019-11-05 14:29:41 -05:00
Brad King
9457c95aa0 cmGlobalXCodeGenerator: Mark known source locations 2019-11-05 14:22:45 -05:00
Alexander Boczar
99e83d4235 cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
Extend the `cmGlobalGenerator::SetGeneratorToolset` signature to
indicate when it is called from `cmake::build`.
2019-10-15 13:28:41 -04:00
Cristian Adam
36ded610af PCH: Generate sources during Compute step 2019-10-09 13:50:25 +02:00
Brad King
83c1657ff7 Unity build: Generate sources during Compute step
The unity build sources need to be added for all generators.  Create
them during `cmGlobalGenerator::Compute` to avoid duplicating the calls
in every generator.  We already handle Qt autogen there too.

Issue: #19789
2019-10-03 14:55:22 -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
Brad King
dce58afd30 Merge branch 'backport-3.15-fix-EXCLUDE_FROM_ALL-subdir-all'
Resolve conflicts with changes since the 3.15 series:

* Convert `cmSystemTools::IsOn` => `cmIsOn`.
* Move one "EXCLUDE_FROM_ALL" target property logic fix to
  its new location in `cmMakefile::AddNewUtilityTarget`.
2019-09-30 09:34:57 -04:00
Brad King
05d7ca14e9 Merge branch 'backport-3.14-fix-EXCLUDE_FROM_ALL-subdir-all' 2019-09-30 09:19:21 -04:00
Brad King
b3b1c7bf3a Restore "all" target in subdirectories marked EXCLUDE_FROM_ALL
The "all" target in each directory is supposed to have targets from that
directory even if the directory itself is marked `EXCLUDE_FROM_ALL` in
its parent.  This was broken by commit dc6888573d (Pass EXCLUDE_FROM_ALL
from directory to targets, 2019-01-15, v3.14.0-rc1~83^2) which made the
participation of a target in "all" independent of context.  Revert much
of the logic change from that commit to restore the old behavior.  Then
re-implement the behavior intended by the commit to keep its test
working.  Extend the test to cover the old behavior too.

Fixes: #19753
2019-09-30 09:18:20 -04:00
Daniel Eiband
5a06efda05 cmMakefile: Remove AddUtilityCommand overload without byproducts 2019-09-26 10:04:03 -04:00
Daniel Eiband
f151a57705 cmMakefile: Move enumerations into new header
The enumerations will also be used in cmLocalGenerator.
2019-09-26 10:02:06 -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
Marc Chevrier
c688b401d3 cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones.  For example:

    #include <cm/string_view>

can be used safely for CMake development in place of the `<string_view>`
standard header.

Fixes: #19491
2019-09-20 10:01:37 -04:00
Daniel Eiband
7f3ecbe7d7 cmCustomCommandLine: Provide command line make functions
Reduce boilerplate necessary to create custom command lines by introducing and
applying cmMakeCommandLine and cmMakeSingleCommandLine functions.
2019-09-16 20:45: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
Brad King
f1f57cffc7 clang-tidy: Fix performance-for-range-copy diagnostic in Xcode generator
Fix diagnostics that appear on macOS with clang-tidy-8.
2019-09-09 13:51:23 -04:00
Brad King
175d8c4bf6 clang-tidy: Resolve performance-unnecessary-value-param diagnostics
Fix diagnostics that appear on macOS with clang-tidy-8.  Suppress cases
where we intentionally take an argument by value to let the caller
choose whether to copy or move.
2019-09-09 13:51:23 -04:00
Brad King
ca8c3d64c8 Merge topic 'use-using'
1d3f5ebb0d clang-tidy: Enable check modernize-use-using
a1ddf2d0ba clang-tidy: Replace typedef with using

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3782
2019-09-06 12:38:04 -04: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
Cristian Adam
7786a05c70 Unity build: Add XCode support 2019-08-30 20:39:37 +02:00
Cristian Adam
28be170fbc Precompile headers: Add support for Xcode generator
Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
2019-08-28 11:47:50 -04:00
Sebastian Holtermann
aaf59120bf Source sweep: Replace cmExpandList with the shorter cmExpandedList
This replaces the code pattern
```
std::vector<std::string> args;
cmExpandList(valueStr, args, ...)
```
with
```
std::vector<std::string> args = cmExpandedList(valueStr, ...)
```
2019-08-23 17:07:49 +02: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
Brad King
bfe0ea2d98 Merge topic 'cm-contains'
2dfc52675c cmAlgorithms: Add cmContains

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !3700
2019-08-21 11:52:06 -04:00
Brad King
5f7386dd19 Merge topic 'string-literal-append'
da26b3be89 avoid adding multiple consecutive string literals to std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3698
2019-08-19 15:06:47 -04:00
Regina Pfeifer
2dfc52675c cmAlgorithms: Add cmContains
Also, use the new function where applicable.
2019-08-19 20:01:39 +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
20e580be01 Source sweep: Use cmIsOn instead of cmSystemTools::IsOn
This replaces invocations of

- `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn`
- `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND`
- `cmSystemTools::IsOn` with `cmIsOn`
- `cmSystemTools::IsOff` with `cmIsOff`
2019-08-17 12:14:14 +02:00
Sebastian Holtermann
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Kitware Robot
54e9d38c28 Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAP 2019-08-09 10:41:44 -04:00
Brad King
bbf4a5771f Merge topic 'tidy_inefficient_string'
18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3648
2019-08-07 11:54:53 -04:00
Sebastian Holtermann
18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation
Enables the clang-tidy test performance-inefficient-string-concatenation
and replaces all inefficient string concatenations with `cmStrCat`.

Closes: #19555
2019-08-05 17:21:00 +02:00
Sebastian Holtermann
7fbcc16dcd cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenize
This adds the following functions to `cmStringAlgorithms`:

- `cmIsSpace`
- `cmTrimWhitespace` (moved from `cmSystemTools::TrimWhitespace`)
- `cmEscapeQuotes` (moved from `cmSystemTools::EscapeQuotes`)
- `cmTokenize` (moved from `cmSystemTools::tokenize` and adapted to
  accept `cm::string_view`)
2019-08-05 11:25:30 +02:00
Sebastian Holtermann
e91bfe440c cmMakefile: Let AddDefinition accept a value as cm::string_view
This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value
argument instead of a `const char *`.

Benefits are:
- `std::string` can be passed to `cmMakefile::AddDefinition` directly without
  the `c_str()` plus string length recomputation fallback.
- Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at
  compile time.

In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid
`std::string::c_str` calls and the `std::string` is passed directly.
Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might
be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
2019-07-24 11:11:25 +02:00
Marc Chevrier
d9b2c7dae2 Introduce memory management helper: cm_memory.hxx 2019-07-14 15:37:30 +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