1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-18 01:38:44 +08:00

814 Commits

Author SHA1 Message Date
Marc Chevrier
f034b0f663 CMake compilation: do not use compiler extensions
For now, compiler extensions are no longer activated on CMake sources.
However these extensions are still used for various third parties.

This MR is a partial answer to the issue #20454.
2020-03-23 10:29:58 +01:00
Marc Chevrier
557cecdc3d Modernize memory management
Update internals of various classes
2020-02-27 11:11:30 +01:00
Marc Chevrier
f7d12609f0 Refactoring: use append functions from cmext/algorithm 2019-12-17 10:44:02 +01:00
Brad King
a4c19cb895 Windows: Restore suppression of error report popups in CI builds
On Windows, libuv uses `_CrtSetReportHook` to install a handler it uses
to suppress assertions on invalid file descriptors in `_get_osfhandle`.
This removes the handler we install in CI environments to suppress
interactive popups.  Move installation of our handler to after libuv is
initialized so that our handler is actually used.

Unfortunately this also removes libuv's handler and so may cause Debug
builds under CI to abort on invalid file descriptors instead of simply
converting them to `INVALID_HANDLE_VALUE`.  If this becomes a problem
we may need to modify libuv to make its hook more configurable.
2019-11-15 09:23:47 -05:00
Craig Scott
0692eaf0fe ForceToRelativePath: Fix spurious assertion when local path is root dir
Fixes: #19909
2019-11-02 17:54:13 +11: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
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Brad King
1a1508c8b8 Merge topic 'modernize-use-auto'
d25a5a7ec9 clang-tidy: modernize-use-auto

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3783
2019-09-12 09:15:38 -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
Rolf Eike Beer
5eaf1e1be2 cmSystemTools: introduce MoveFileIfDifferent() 2019-09-09 10:30:25 +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
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Sebastian Holtermann
3b6c62be23 cmSystemTools: Remove IsInternallyOn, IsNOTFOUND, IsOn, IsOff
The removes the following methods from cmSystemTools:

- `IsInternallyOn`
- `IsNOTFOUND`
- `IsOn`
- `IsOff`
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
2f6495e24e cmSystemTools: Remove ExpandListArgument methods 2019-08-14 16:33:20 +02:00
Kyle Edwards
fb56ac9209 Merge topic 'retry-directory-delete'
6bc77966ad Retry removing directories on Windows
5729580376 Use registry setting for removal retry count and delay

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3667
2019-08-13 10:07:09 -04: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
Kasper Laudrup
5729580376 Use registry setting for removal retry count and delay
Instead of hardcoding the amount of retries and the time to sleep
between them when removing directories on Windows, use the setting
potentially present in the registry instead. This setting is already
used when retrying moving directories.
2019-08-08 15:59:02 +02: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
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
09977c1816 cmSystemTool: Let TrimWhitespace accept a cm::string_view 2019-07-28 17:47:26 +02:00
Sebastian Holtermann
2f19e53705 cmSystemTool: Let HelpFileName accept a cm::string_view 2019-07-28 17:47:26 +02:00
Sebastian Holtermann
2c5454f227 cmSystemTool: Let EscapeQuotes accept a cm::string_view 2019-07-28 17:47:26 +02:00
Sebastian Holtermann
ad3183db8c cmSystemTool: Let Expand(ed)ListArgument accept a cm::string_view 2019-07-28 17:47:26 +02:00
Kyle Edwards
618bd463ad Merge topic 'remove_compiler_rpath'
bd2793b6e9 Help: Add documentation for INSTALL_REMOVE_ENVIROMENT_RPATH
f08dcbffec Property: Add INSTALL_REMOVE_ENVIROMENT_RPATH property

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3544
2019-07-26 12:01:27 -04:00
Jiang Yue
f08dcbffec Property: Add INSTALL_REMOVE_ENVIROMENT_RPATH property 2019-07-25 12:30:23 -04:00
Sebastian Holtermann
4ff0bb054b cmSystemTools: Make IsInternallyOn, IsON and IsOff cm::string_view based 2019-07-24 19:31:14 +02:00
Sebastian Holtermann
f8a310c9d1 cmSystemTools: Remove cmSystemTools::FileFormat method 2019-07-04 13:46:19 +02:00
Brad King
6e8acc51a5 Merge topic 'string-tar'
57cedb18c0 cmSystemTools: std::string parameters for tar functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3392
2019-05-30 09:57:11 -04:00
Brad King
05af1770a0 Merge topic 'tar-zstd-compression'
53cb1f2d04 cmake: Teach cmake -E tar command, Zstandard compression

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3357
2019-05-30 09:39:35 -04:00
Vitaly Stakhovsky
57cedb18c0 cmSystemTools: std::string parameters for tar functions 2019-05-29 09:56:08 -04:00
Brad King
4ec2b99941 Merge topic 'selective-tar-extracting-and-listing'
c8e217e0a7 cmake: tar: Allow selective extracting and listing of archives

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3342
2019-05-24 10:43:14 -04:00
Sebastian Holtermann
006229278b Use cmAppend to append ranges to std::vector instances 2019-05-23 16:19:49 +02:00
Bartosz Kosiorek
c8e217e0a7 cmake: tar: Allow selective extracting and listing of archives 2019-05-23 10:08:22 -04:00
Brad King
a4faf7788c Merge topic 'string-error'
e884b1b693 cmSystemTools::Error(): remove const char* overload

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3360
2019-05-23 09:05:47 -04:00
Vitaly Stakhovsky
e884b1b693 cmSystemTools::Error(): remove const char* overload 2019-05-22 10:51:06 -04:00
Sebastian Holtermann
5b53cfda24 cmSystemTools: Remove cmSystemToolsFileTime interface
This removes the C style cmSystemToolsFileTime interface in cmSystemTools.
It was replaced by the RAII based cmFileTimes class.
2019-05-22 10:57:10 +02:00
Bartosz Kosiorek
53cb1f2d04 cmake: Teach cmake -E tar command, Zstandard compression
Fixes #18657
2019-05-22 03:46:55 +02:00
Sebastian Holtermann
cdff7f4e2a cmSystemTools: Add ExpandedListArgument and ExpandedLists methods
Changes
-------

In `cmSystemTools` this
- renames the method `ExpandList` to `ExpandLists` and makes it iterator based

and adds the methods
- `std::vector<std::string> ExpandedLists(InputIt first, InputIt last)`
- `std::vector<std::string> ExpandedListArgument(const std::string& arg,
                                                       bool emptyArgs)`

Both return the  `std::vector<std::string>` instead of taking a return vector
reference like `cmSystemTools::ExpandLists` and
`cmSystemTools::ExpandListArgument`.

Motivation
----------

Since C++17 return value optimization is mandatory, so returning a
`std:vector<std::string>` from a function should be (at least) as fast as
passing a return vector reference to the function.

The new methods can replace `cmSystemTools::ExpandLists` and
`cmSystemTools::ExpandListArgument` in many cases, which leads to
shorter and simpler syntax.

E.g. the commonly used pattern
```
  if (const char* value = X->GetProperty("A_KEY_STRING")) {
    std::vector<std::string> valuesList;
    cmSystemTools::ExpandListArgument(value, valuesList);
    for (std::string const& i : valuesList) {
      doSomething(i);
    }
  }
```
becomes
```
  if (const char* value = X->GetProperty("A_KEY_STRING")) {
    for (std::string const& i :
      cmSystemTools::ExpandedListArgument(value)) {
      doSomething(i);
    }
  }
```
2019-05-13 15:37:18 +02: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
Alex Turbov
377d1b7896 cmSystemTools: Remove unused message-related code, simplify logic 2019-04-27 18:36:45 +10:00
Brad King
f0948499f6 cmSystemTools: Fix StringToULong to reject negative numbers
Fixes: #19161
2019-04-11 12:56:32 -04:00
Brad King
23a84ac990 Merge topic 'dedup-path-normalization'
b52d9d6960 cmSystemTools: Drop unused CollapseCombinedPath method
a13a5c948e Replace use of CollapseCombinedPath with CollapseFullPath

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@xwmw.org>
Merge-request: !3117
2019-03-20 11:32:12 -04:00
Brad King
b52d9d6960 cmSystemTools: Drop unused CollapseCombinedPath method
All call sites have been converted to `CollapseFullPath`, so the
now-unused `CollapseCombinedPath` can be removed.

Fixes: #19050
2019-03-19 10:00:08 -04:00
Bartosz Kosiorek
8634576dcb cmake: Don't interrupt archive creation if unable to read a file.
Rationale:
Currently during creation of archive by 'tar',
if error appears, it interrupt archive creation.
As a result only part of files are archived

This behaviour is not consistent with 'copy_directory', native 'tar'
and other command behaviour.
With this Merge Request this behaviour is fixed.
2019-03-18 17:55:35 +01:00
Brad King
a4d99e4dec Merge topic 'cmrange-improvements'
b8031308f3 cmRange: Add unit tests
a8d51ef8b7 cmRange: Add functions filter and transform
da4773e8b8 cmRange: Add functions all_of, any_of, none_of
17a367e77f cmRange: Stylistic cleanup
9eb0e73f46 cmRange: Move to dedicated header file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Artur Ryt <artur.ryt@gmail.com>
Merge-request: !2972
2019-02-25 08:03:01 -05:00