303 Commits

Author SHA1 Message Date
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
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
Sebastian Holtermann
735c6f39d9 Fix invalid ///! doxygen comment line starts
In various places `///!` was used to start a comment line.  This is not valid
Doygen syntax.  This patch replaces `///!` comment starts with `//!`.
2019-03-31 11:27:12 +02:00
Kyle Edwards
fac093802a Merge topic 'tar-improve-error-handling'
ea9a2c1759 cmake: tar: Parse 'cmake -E tar' arguments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3081
2019-03-21 10:50:38 -04:00
Bartosz Kosiorek
ea9a2c1759 cmake: tar: Parse 'cmake -E tar' arguments 2019-03-20 09:28:49 -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
Vitaly Stakhovsky
4e315e9449 cmSystemTools: More functions accept std::string params 2019-02-20 14:53:39 -05:00
Vitaly Stakhovsky
bd20cc29a2 cmSystemTools: Remove redundant cmCopyFile() and Split() 2019-02-15 09:52:29 -05:00
Vitaly Stakhovsky
080a79ca4a cmSystemTools: More methods accept std::string params 2019-02-11 18:11:59 -05:00
Brad King
89ca5d7fdc Merge topic 'message-stdstring'
82edd98300 cmSystemTools: MessageCallback and Message() accept std::string argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2929
2019-02-08 08:49:35 -05:00
Vitaly Stakhovsky
82edd98300 cmSystemTools: MessageCallback and Message() accept std::string argument 2019-02-07 13:41:27 -05:00
Vitaly Stakhovsky
65baaa0e37 cmSystemTools::RunSingleCommand: Accept std::string argument 2019-02-06 11:02:10 -05:00
Sebastian Holtermann
ed0fa784eb cmSystemTools: Let GetFileFormat accept a std::stding const&
The `const char*` used formerly was converted to a `std::string`
internally anyway.
2019-02-02 18:42:08 +01:00
Brad King
fb82385515 Merge topic 'std-string-callback'
1180fc8780 OutputCallback: Accept std::string argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: vvs31415 <vstakhovsky@fastmail.com>
Merge-request: !2891
2019-01-31 11:13:34 -05:00
Brad King
eb2c23868f Merge topic 'tidy-use-equals-delete'
b05b778a2d clang-tidy: Use `= delete`

Acked-by: Kitware Robot <kwrobot@kitware.com>
Rejected-by: vvs31415 <vstakhovsky@fastmail.com>
Merge-request: !2848
2019-01-30 14:00:58 -05:00
Regina Pfeifer
1180fc8780 OutputCallback: Accept std::string argument 2019-01-30 18:33:58 +01:00
Brad King
c30f9b1cde Merge topic 'functional-callbacks'
8c92db829b MessageCallback: Remove unused bool& argument
bcee24aecc Use `std::function` for callbacks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: vvs31415 <vstakhovsky@fastmail.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !2872
2019-01-30 08:10:27 -05:00
Regina Pfeifer
b05b778a2d clang-tidy: Use = delete 2019-01-29 14:09:21 -05:00
Regina Pfeifer
8c92db829b MessageCallback: Remove unused bool& argument 2019-01-29 16:35:53 +01:00
Vitaly Stakhovsky
c31b6e616d cmSystemTools: copy file member functions accept std::string params
Cleaned up `c_str()`s.
`cmSystemTools::CopyFileIfDifferent()` removed as redundant.
2019-01-29 10:34:18 -05:00
Regina Pfeifer
bcee24aecc Use std::function for callbacks 2019-01-29 16:32:52 +01:00
Vitaly Stakhovsky
186d9b083d cmSystemTools::Message: Add overload accepting std::string 2019-01-28 09:35:51 -05:00
Brad King
c18fc30d1a Merge topic 'renamefile-string'
9e5c13738b cmSystemTools::RenameFile: Accepts std::string args

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2842
2019-01-25 08:00:14 -05:00
Vitaly Stakhovsky
99337d345b cmSystemTools::Error(): new overload accepting std::string 2019-01-23 10:19:30 -05:00
Vitaly Stakhovsky
9e5c13738b cmSystemTools::RenameFile: Accepts std::string args 2019-01-22 20:37:59 -05:00
Brad King
cb7fbf1dbb Merge topic 'stdout-string'
3132ea801c cmSystemTools: Stdout(),Stderr() accept std::string argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2829
2019-01-22 09:32:58 -05:00
Vitaly Stakhovsky
3132ea801c cmSystemTools: Stdout(),Stderr() accept std::string argument 2019-01-20 00:03:35 -05:00
Tushar Maheshwari
0f08ed8936 cmSystemTools: Silence CreateLink and CreateSymlink errors
If provided, report errors to a std::string.
This allows "silent" fallback to another flow, like COPY_ON_ERROR.
2019-01-16 10:03:35 -05:00
Tushar Maheshwari
81650e488c cmFileCommand: Add CREATE_LINK subcommand
This brings the functionality of `cmake -E create_symlink` and more to scripts.

The default behavior is to create hard links.
The `SYMBOLIC` argument can be used to create symlinks instead.

The `COPY_ON_ERROR` argument enables a fallback to copying the file in case the link fails.

The `RESULT <var>` retrieves the error message generated by the system.
It is set to "0" on success.

Fixes: #16926
2019-01-16 10:03:35 -05:00
Bruno Manganelli
87e810f223 cmOutputConverter: Moved ForceToRelativePath to cmSystem 2018-12-07 19:29:30 +00:00
Brad King
652210e901 cmSystemTools: Add EncodeURL helper
Factor a URL encoding implementation out of CTest.
Add an option to not escape slashes.

Suggested-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2018-11-28 14:27:22 -05:00
Jon Chronopoulos
afb7f6e4ff cmake: Add '-E create_symlink' support on Windows
The allows `-E create_symlink` to work on Windows.  It utilizes
`uv_fs_symlink`.  I am still unsure exactly which Windows platforms will
work without requiring Administrator privileges or needing a user/group
with the "Create Symbolic Links" User Rights.  It does work with my
Windows 10 Pro with Developer Mode turned on.  In the test suite check
that the symlink either worked or failed with a permissions error.

Use recent changes in cmSystemTools::FileExists to check that a symlink
is broken.
2018-09-18 11:24:08 -04:00
Vitaly Stakhovsky
1fa0f2bd03 cmSystemTools: Add IsOn(),IsOff() overloads accepting std::string 2018-08-31 14:58:03 -04:00