1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-20 03:38:05 +08:00

647 Commits

Author SHA1 Message Date
Rolf Eike Beer
ec7928ef26 use _s to construct static string_views at several places
This should avoid the runtime strlen() call.
2020-03-24 19:40:44 +01:00
Rolf Eike Beer
8ca2504a4d use string_views to avoid memory allocations 2020-03-24 17:50:37 +01:00
Rolf Eike Beer
ef778d77e0 replace std::string::substr() with operations that do not allocate memory
Modify the original string instead of creating a new copy with substr() when it
is not used for anything else afterwards.
2020-03-23 22:41:44 +01:00
Rolf Eike Beer
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix() 2020-03-23 22:41:43 +01:00
Rolf Eike Beer
7df84ffe58 allow cmCTest::CleanString() to skip input characters
This entirely avoids that one needs to call std::string::substr() for the
input.
2020-03-23 20:19:26 +01:00
Rolf Eike Beer
d6a4e9fbc8 CTest: avoid repeated string compares
Only one key can match per iteration, avoid any further compares when one match
was already found. While at it entirely avoid that the key and value strings are
copied.
2020-03-23 20:18:02 +01:00
Marc Chevrier
557cecdc3d Modernize memory management
Update internals of various classes
2020-02-27 11:11:30 +01:00
Stefan Dinkelacker
a39d4139d0 Add --no-tests=<[error|ignore]> option to CTest
If no tests were found, the default behavior of CTest is to always log an
error message but to return an error code in script mode only. This option
unifies the behavior of CTest by either returning an error code if no tests
were found or by ignoring it.

Signed-off-by: Stefan Dinkelacker <s.dinkelacker@dkfz-heidelberg.de>
2020-01-31 18:17:13 +01:00
Marc Chevrier
f7d12609f0 Refactoring: use append functions from cmext/algorithm 2019-12-17 10:44:02 +01:00
Brad King
32c165d263 CTest: Consolidate '--repeat-* n' options as --repeat *:n
Combine `--repeat-until-fail`, `--repeat-until-pass`, and
`--repeat-after-timeout` to create a single `--repeat <mode>:<n>`
option.  Retain `--repeat-until-fail` too because that has been
available in previous releases.
2019-11-15 10:08:33 -05:00
Brad King
ed65b3e984 CTest: Rename internal APIs for --repeat options
Replace use of the term "rerun" with "repeat" to match the public names.
2019-11-07 14:14:28 -05:00
Brad King
016601e5e6 Merge branch 'backport-ctest-resource-groups' 2019-11-05 12:59:16 -05:00
Craig Scott
a7c1e15cc4 CTest: Rename hardware -> resources for CMake variables, command options
Only changes the user-visible effects of renaming hardware
allocation to resource allocation. Code changes are the minimum
needed to achieve that.
2019-11-05 12:08:35 -05:00
Brad King
39ac8b4eb5 ctest: Add --repeat-after-timeout option
Add an option to re-run tests if they timeout.  This will help tolerate
sporadic timeouts on busy machines.
2019-10-29 15:14:36 -04:00
Brad King
80c2c9d14c ctest: Add --repeat-until-pass option
Add an option to re-run tests if they fail.  This will help tolerate
sporadic failures.

Issue: #17010
Co-Author: Ben Boeckel <ben.boeckel@kitware.com>
Co-Author: Chuck Atkins <chuck.atkins@kitware.com>
2019-10-29 15:10:12 -04:00
Kyle Edwards
e34de0691b CTest: Allocate hardware to tests 2019-10-02 09:33:54 -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
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
Brad King
d16402ddc4 Merge topic 'ctest-CLICOLOR_FORCE'
074a6a8cf6 CTest: Add env var CLICOLOR_FORCE to force color output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3733
2019-08-27 10:54:24 -04:00
Marin Baron
074a6a8cf6 CTest: Add env var CLICOLOR_FORCE to force color output
Base impl on `Source/kwsys/Terminal.c:kwsysTerminalStreamIsVT100`.
This enables pipes/logs with colors.
2019-08-26 11:04:57 -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
8685d0d291 Merge topic 'source_sweep_cmExpandedList'
aaf59120bf Source sweep: Replace cmExpandList with the shorter cmExpandedList

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3725
2019-08-26 10:47:24 -04:00
Brad King
e7d7cd47ed Merge topic 'group_not_track'
2a71a0390c ctest: rename TRACK to GROUP

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Zack Galbreath <zack.galbreath@kitware.com>
Merge-request: !3707
2019-08-26 10:34:55 -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
Zack Galbreath
2a71a0390c ctest: rename TRACK to GROUP
Update command-line options, script variables, and documentation to use
the term "group" instead of "track". The old terms are still available
for now, but they are now undocumented.

This makes our terminology more consistent with CDash. The goal of this
change is to make it more clear to our users how CTest and CDash interact
with each other.
2019-08-22 13:10:18 -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
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
Kyle Edwards
2beed5a4ef Merge topic 'cmExpandList'
2f6495e24e cmSystemTools: Remove ExpandListArgument methods
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument
ff42dec891 cmStringAlgorithms: Add cmExpandList functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3682
2019-08-16 14:51:03 -04:00
Kyle Edwards
dcf2beb7de Merge topic 'cmStringAlgorithms_ulong'
935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3681
2019-08-16 14:49:28 -04:00
Sebastian Holtermann
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Sebastian Holtermann
935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong
This adds the following functions to cmStringAlgorithms:
- `cmStrToLong`: moved from `cmSystemTools::StringToLong`
- `cmStrToULong`: moved from `cmSystemTools::StringToULong`

Overloads of the given functions for `std::string` are added as well.
2019-08-10 14:39:03 +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
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
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
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
b821f9ad62 Refactor: Optimize some stream output operations
- remove redundant `std::flush` right after `std::endl`
- join some string literals

Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-10 01:06:14 +03:00
Vitaly Stakhovsky
57cedb18c0 cmSystemTools: std::string parameters for tar functions 2019-05-29 09:56:08 -04:00
Sebastian Holtermann
006229278b Use cmAppend to append ranges to std::vector instances 2019-05-23 16:19:49 +02:00
Zack Galbreath
d8af0700a3 ctest: consistently format generator name
Notes.xml and Upload.xml were missing a hyphen that the rest of
our XML files included.

ctest3.14.0-rc1 vs. ctest-3.14.0-rc1
2019-04-23 15:02:14 -04:00
Regina Pfeifer
5a72dbd40c cmCTest: Remove dead code 2019-03-20 11:41:29 -04:00
Regina Pfeifer
a5eeb0310d cmCTest: Cleanup typedefs 2019-03-20 11:41:29 -04:00
Regina Pfeifer
71a3391b5f cmCTest: Use default member initialization 2019-03-20 11:41:29 -04:00
Regina Pfeifer
b172a81d55 cmCTest: Use concrete accessor functions for TestingHandlers 2019-03-20 11:39:14 -04:00
Regina Pfeifer
46090c2337 cmCTest: Store TestingHandlers by value 2019-03-18 22:55:51 +01:00
Regina Pfeifer
da5ee509b2 cmCTest: Move all data members to private implementation struct 2019-03-18 22:55:50 +01:00