876 Commits

Author SHA1 Message Date
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
Brad King
0d06cc457c CPack/FreeBSD: Cleanup include-what-you-use diagnostics 2019-09-05 09:03:26 -04:00
Brad King
fcba9c3baa Merge topic 'cpack-zstd'
e26f0e9dd5 CPack: Add generator for .tar.zst packages
f7085d7b0a cmCPackArchiveGenerator: Code cleanup

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3752
2019-09-05 08:24:50 -04:00
Regina Pfeifer
e26f0e9dd5 CPack: Add generator for .tar.zst packages 2019-09-04 13:05:22 -04:00
Regina Pfeifer
f7085d7b0a cmCPackArchiveGenerator: Code cleanup 2019-09-04 13:05:22 -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
Regina Pfeifer
62e5f72289 clang-tidy: Replace typedef with using 2019-09-03 13:21:26 -04:00
Brad King
de0a2354fc IWYU: Add missing cstddef includes for size_t and nullptr_t
The IWYU tool we use for CI now diagnoses these.
2019-09-03 11:46:52 -04:00
Brad King
2e6effd2e0 Merge topic 'cpack-install-multiple-configurations'
da5ac4bb60 cpack: Add `CPACK_INSTALL_CMAKE_CONFIGURATIONS` variable
d4e6b2ae25 Refactor: Use `unique_ptr` instead of raw pointer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3533
2019-09-03 09:30:15 -04:00
Alex Turbov
da5ac4bb60 cpack: Add CPACK_INSTALL_CMAKE_CONFIGURATIONS variable
For the multi-configuration generators one can specify the list
of configurations to include in the package.

E.g. having a project, where debug libraries have a suffix to
distinct them from the release builds, one can build the package
containing both `Debug` and `Release` binaries.
2019-08-30 11:02:43 -04:00
Konstantin Podsvirov
9367f7dcdd CPack/IFW: Command vectorization
Fixes: #19634
2019-08-27 11:30:19 -04:00
Brad King
89479bde94 Merge topic 'pvs-cleanup'
7fe3e874d5 cmCPackLog: Fix support for multiple log message tags
74f2c0ea56 cmCTestTestHandler: Remove extra layer of parentheses
7c2767ef3b cmCTestMultiProcessHandler: Explain testRun ownership in comments
303e813438 CTest: Simplify some boolean conditions
51565abe79 cmMessageCommand: Remove extra layer of parentheses
b1cfaf7b91 cmVSSetupHelper: Remove unused SmartBSTR copy operations
3f4c4e7afe cmVSSetupHelper: Fix SmartBSTR copy operations
a8ca5aea94 cmMakefileTargetGenerator: Check for null before using a pointer
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Acked-by: Artalus <artalus-mail@yandex.ru>
Merge-request: !3715
2019-08-26 10:51:11 -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
Brad King
7fe3e874d5 cmCPackLog: Fix support for multiple log message tags
Fix logic from commit bbf1c2d275 (ENH: More improvements and add
logging, 2006-01-02, v2.4.0~712) to append to the accumulated tag string
instead of overwriting it for each type of message.

Issue: #19610
2019-08-26 09:43:46 -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
dfb5936f0f Merge topic 'shared-string'
be7807478c cmDefinitions: Reduce allocation of keys and values in MakeClosure
e07e2bc8bb bootstrap: Compile cm::String
c1787cb5eb cpack.cxx: Re-order include blocks to follow our conventions
141e307484 cmConfigure.h: Tell windows.h not to define min/max macros

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3669
2019-08-21 11:57:05 -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
Brad King
c1787cb5eb cpack.cxx: Re-order include blocks to follow our conventions 2019-08-20 09:36:45 -04:00
Alex Turbov
d4e6b2ae25 Refactor: Use unique_ptr instead of raw pointer 2019-08-19 15:25:06 -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
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
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
a693e875db Cleanups: Use cmHas{Prefix,Suffix} instead of String{Starts,Ends}With 2019-08-01 13:33:00 +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
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
Craig Scott
9e42075498 Merge topic 'cpack-install-scripts'
5f96601675 CPack: Introduce CPACK_INSTALL_SCRIPTS variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3531
2019-07-22 07:04:00 -04:00
Alex Turbov
5f96601675
CPack: Introduce CPACK_INSTALL_SCRIPTS variable
The singular name `CPACK_INSTALL_SCRIPT` has existed but was not linked
from the CPack documentation.  Also, it supported multiple values and
should have had a plural name.  Add a plural-named alternative now.
If both `CPACK_INSTALL_SCRIPTS` and `CPACK_INSTALL_SCRIPT` are set then
ignore the latter with a warning.

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-22 02:01:44 +03:00
Marc Chevrier
d9b2c7dae2 Introduce memory management helper: cm_memory.hxx 2019-07-14 15:37:30 +02:00
Craig Scott
a2319c04f6 Merge topic 'cleanup-statics-stream-flush'
af75ab7645 Refactor: Use anonymous namespace instead of `static`s in `cpack.cxx`
0db458a0ce Refactor: Use anonymous namespace instead of `static`s
0328b64efd Refactor: Remove one-time used macros
b821f9ad62 Refactor: Optimize some stream output operations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3535
2019-07-12 20:26:12 -04:00
Brad King
e15314420c Merge topic 'iwyu-memory'
71fbebd1dc IWYU: Fix handling of <memory> standard header

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Marc Chevrier <marc.chevrier@gmail.com>
Merge-request: !3536
2019-07-11 08:52:36 -04: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
Alex Turbov
af75ab7645 Refactor: Use anonymous namespace instead of statics in cpack.cxx
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-10 01:07:18 +03:00
Alex Turbov
98617f1be0
Refactor: Move CPack internal files to Internal/CPack/ directory
Some commits ago all CPack internal `*.cmake` files have been moved
to `Internal/CPack/`. This commit also move some templates
internally used by generators to the same location to make
`Modules/` directory less noisy w/ files the end users don't
need to use/see.
2019-07-09 15:45:03 +03:00
Sebastian Holtermann
9c576a88d9 Use cmFileTimes instead of cmSystemToolsFileTime interface 2019-05-22 10:57:10 +02:00
Brad King
186ca170da Merge topic 'std-pipes-always'
c85524a94a Ensure stdin, stdout, and stderr pipes are always open

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !3282
2019-05-03 11:48:46 -04:00
Brad King
c85524a94a Ensure stdin, stdout, and stderr pipes are always open
On non-Windows platforms libuv assumes that file descriptors 0-2 are
always used for standard pipes and never for anything else.  Otherwise,
libuv may re-use one of these descriptors and then fail an assertion
when closing it.  Similarly, On Windows platforms our ConsoleBuf
implementation assumes that the standard handles are always open.

If CMake is run with any standard pipes closed, open them with
`/dev/null` or `NUL` to satisfy these assumptions.

Fixes: #19219
2019-05-02 14:34:58 -04:00
Zaytsev Yuriy
c474fb2777 CPack/IFW: Add StyleSheet field 2019-05-02 13:01:31 -04:00
Brad King
67645c132b cpack: Remove unused file with old development notes 2019-04-11 10:56:05 -04:00
Brad King
0090907e86 tidy: Fix modernize-raw-string-literal in FreeBSD CPack generator 2019-04-05 08:32:39 -04:00
Artur Ryt
30bb14c657 Modernize: Enable modernize-raw-string-literal in clang-tidy 2019-04-02 19:59:54 +02:00
Artur Ryt
2d66567dca Modernize: Prefer .substr in place of .c_str() + int
A lot of temporary/local strings were created out of C-strings
substr can utilize current string size, so in theory be a little
more efficient.
2019-03-30 16:15:05 +01:00
Brad King
a13a5c948e Replace use of CollapseCombinedPath with CollapseFullPath
`CollapseCombinedPath` was introduced by commit 551d3343cd (cmDependsC:
Collapse relative include paths, 2013-06-19, v2.8.12~237^2) where the
existing `CollapseFullPath` should have been used instead.  Then its use
proliferated slightly.  Since `CollapseCombinedPath` is less widely used
and less robust (see issue #19049), use `CollapseFullPath` everywhere
instead.

Issue: #19050
2019-03-19 09:57:23 -04:00
Vitaly Stakhovsky
4e315e9449 cmSystemTools: More functions accept std::string params 2019-02-20 14:53:39 -05:00
Vitaly Stakhovsky
0281f9a4ca cmMakefile::ConfigureFile: Accept std::string parameters 2019-02-18 20:48:19 -05:00
Albert Astals Cid
ae5e97a005 Delete some default constructors and assignment operators
They are unused, but if someone used them they would lead to
problems since they would copy the internal raw pointers
and the destructor would cause double delete
2019-02-15 07:25:47 -05:00
Brad King
8914d4317a Merge topic 'systools-stdstring2'
080a79ca4a cmSystemTools: More methods accept `std::string` params

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2952
2019-02-13 10:17:08 -05:00