1059 Commits

Author SHA1 Message Date
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
7847fef510 VS: Fix access violation when calling Visual Studio macro
Fixes: #19730
2019-09-24 17:44:28 +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
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
d63c1e4e6e clang-tidy: modernize-return-braced-init-list 2019-09-06 22:27:39 +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
Brad King
843ab7544e Merge topic 'cmake-initial-cache-dirs'
4ca0526f8a cmake: Pass -S and -B into PreLoad.cmake and -C scripts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3709
2019-08-27 11:23:22 -04:00
Peter Waller
4ca0526f8a cmake: Pass -S and -B into PreLoad.cmake and -C scripts
Before this, it was not possible to see what the source or build directories
were set to on the command line.

Fixes: #19619
2019-08-27 10:51:40 -04:00
Brad King
37c671570c Merge topic 'source_sweep_ostringstream_single'
3b2b02825d Source sweep: Replace std::ostringstream when used with a single append

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3726
2019-08-26 10:49:10 -04:00
Sebastian Holtermann
3b2b02825d Source sweep: Replace std::ostringstream when used with a single append
This replaces `std::ostringstream`, when it is written to only once.
If the single written argument was numeric, `std::to_string` is used instead.
Otherwise, the single written argument is used directly instead of the
`std::ostringstream::str()` invocation.
2019-08-23 18:52:33 +02: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
337be1507d Merge topic 'isolate-declarations'
d331021255 clang-tidy: isolate declarations for readability

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3704
2019-08-22 10:23:34 -04: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
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Brad King
a0c8405d68 Merge topic 'trace-redirect'
3c94069660 Add --trace-redirect parameter to redirect trace output to a file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3645
2019-08-20 09:20:49 -04:00
Regina Pfeifer
2dfc52675c cmAlgorithms: Add cmContains
Also, use the new function where applicable.
2019-08-19 20:01:39 +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
Kyle Edwards
9ab15fa74a Merge topic 'cmRemoveQuotes'
27090096ef cmStringAlgorithms: Add cmRemoveQuotes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3665
2019-08-13 09:52:23 -04:00
Igor Ivanov
3c94069660 Add --trace-redirect parameter to redirect trace output to a file 2019-08-10 11:41:53 +03:00
Kitware Robot
54e9d38c28 Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAP 2019-08-09 10:41:44 -04:00
Sebastian Holtermann
27090096ef cmStringAlgorithms: Add cmRemoveQuotes
- Add `cmRemoveQuotes` function to cmStringAlgorithms
- Remove unused removeQuotes inline functions
2019-08-09 12:20:50 +02: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
0962589627 cmake: Initialize booleans at declaration and cleanup constructor 2019-08-03 11:44:38 +02:00
Sebastian Holtermann
a693e875db Cleanups: Use cmHas{Prefix,Suffix} instead of String{Starts,Ends}With 2019-08-01 13:33:00 +02:00
Brad King
1672d3d5a5 Merge topic 'clang-tidy-8'
4af094c8df clang-tidy: Blacklist violations for version 8

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3627
2019-07-31 11:54:28 -04:00
Regina Pfeifer
4af094c8df clang-tidy: Blacklist violations for version 8
Check the codebase with clang-tidy version 8, fix the low hanging
fruits, blacklist the rest.
2019-07-30 12:38:30 +02:00
Sebastian Holtermann
f71f7ce3f0 cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.h
This adds the `cmStringAlgorithms.h` header and moves all string functions
from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
2019-07-29 21:13:56 +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
Sebastian Holtermann
e50fa44a35 cmake: Refactor file extension list setup
Refactor the file extention list setup in cmake.h/cxx and add file extensions
lists for Cuda and Fortran.
2019-07-04 13:46:15 +02:00
Alex Turbov
5e52de7d57 modermize: replace some raw pointers w/ unique_ptr 2019-06-24 09:36:09 -04:00
Brad King
c932f49842 cmake: Teach -E capabilities to report supported fileapi requests
Fixes: #19339
2019-06-07 11:08:38 -04:00
Brad King
6696855f72 cmake: Simplify implementation of -E capabilities
The `cmake -E capabilities` command-line tool is implemented only in a
full-featured (non-bootstrap) CMake, and server mode is now always
available in this case.
2019-06-07 11:08:38 -04:00
Sebastian Holtermann
006229278b Use cmAppend to append ranges to std::vector instances 2019-05-23 16:19:49 +02:00
Brad King
8ed6efbbd3 Merge topic 'default-generator-env'
d0f0ba0f7a Tests: Add environment generator tests
a48ce8f4bf Help: Add documentation for default generator environment variables
083cf7e8a2 cmake: Allow default generator to be set by environment variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3218
2019-05-22 10:32:43 -04:00
Vitaly Stakhovsky
273257222e Source: change parameters to std::string 2019-05-19 10:33:26 -04:00
Eicke Herbertz
083cf7e8a2 cmake: Allow default generator to be set by environment variables
When there is no Generator available in the Cache, this will read
CMAKE_GENERATOR from environment before using the CMake platform default.
If CMAKE_GENERATOR is empty, use the platform default.

If a environment default generator is specified, subsequent variables
CMAKE_GENERATOR_(INSTANCE,PLATFORM,TOOLSET) are also evaluated
in the same way.
2019-05-16 23:00:27 +02:00
Kyle Edwards
8cc04b1918 cmake: Display error if generate step fails 2019-05-13 10:31:39 -04:00
Alex Turbov
6cc93b370e message(): Add support for log levels
Relates: #18943
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2019-04-28 22:45:44 +10:00
Alex Turbov
99698ee351 cmake: Fix missed return statement when CLI errors found 2019-04-01 08:31:25 +11:00
Brad King
89abbdd8c8 Merge topic 'ghs-linux'
2c43fb5be3 FindThreads: Fix pthread library check in GHS Multi Generator
0404efe786 GHS: Add support for GHS Multi Generator in Linux
2060a1445c Tests: Fix file name case in GHS object library test
ddad70c8a4 Tests: Run GHS tests in a separate ctest process
f7dca1fc97 GHS: Fix include-what-you-use and clang-tidy diagnostics

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3006
2019-03-22 09:22:44 -04:00
Naren Manimohan
0404efe786 GHS: Add support for GHS Multi Generator in Linux 2019-03-21 12:57:40 -04:00
Sebastian Holtermann
ec3c968de2 cmake: Use scopes to limit temporary object lifetime 2019-03-18 15:09:11 +01:00
Sebastian Holtermann
5536cec46e Rename cmFileTimeCache::FileTimeCompare to cmFileTimeCache::Compare 2019-03-18 15:09:11 +01:00
Sebastian Holtermann
a6d75a1ce0 Substitute FileComparison in variable names with FileTimeCache 2019-03-18 15:09:11 +01:00
Sebastian Holtermann
216416219a Rename cmFileTimeComparison to cmFileTimeCache
The name `cmFileTimeCache` reflects the functionality of the class more
appropriately.
2019-03-18 15:09:11 +01:00
Brad King
83183cbaec Merge topic 'vs-no-stamp-messages'
67428e9025 VS: Do not print message when generate.stamp is up-to-date.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3054
2019-03-06 08:37:14 -05:00