summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Source sweep: Use cmStrCat for string concatenationSebastian Holtermann2019-08-221-54/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)`
* clang-tidy: isolate declarations for readabilityRegina Pfeifer2019-08-201-1/+2
|
* cmSystemTools: Remove IsInternallyOn, IsNOTFOUND, IsOn, IsOffSebastian Holtermann2019-08-171-79/+0
| | | | | | | | | The removes the following methods from cmSystemTools: - `IsInternallyOn` - `IsNOTFOUND` - `IsOn` - `IsOff`
* Merge topic 'cmExpandList'Kyle Edwards2019-08-161-73/+0
|\ | | | | | | | | | | | | | | | | 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
| * cmSystemTools: Remove ExpandListArgument methodsSebastian Holtermann2019-08-141-73/+0
| |
* | Merge topic 'cmStringAlgorithms_ulong'Kyle Edwards2019-08-161-22/+0
|\ \ | |/ |/| | | | | | | | | 935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3681
| * cmStringAlgorithms: Add cmStrToLong and cmStrToULongSebastian Holtermann2019-08-101-22/+0
| | | | | | | | | | | | | | | | 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.
* | Merge topic 'retry-directory-delete'Kyle Edwards2019-08-131-2/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | 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
| * | Use registry setting for removal retry count and delayKasper Laudrup2019-08-081-2/+8
| |/ | | | | | | | | | | | | 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.
* | Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAPKitware Robot2019-08-091-14/+14
|/
* Merge topic 'tidy_inefficient_string'Brad King2019-08-071-1/+1
|\ | | | | | | | | | | | | 18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3648
| * clang-tidy: Enable performance-inefficient-string-concatenationSebastian Holtermann2019-08-051-1/+1
| | | | | | | | | | | | | | Enables the clang-tidy test performance-inefficient-string-concatenation and replaces all inefficient string concatenations with `cmStrCat`. Closes: #19555
* | cmStringAlgorithms: cmIsSpace, cmTrimWhitespace, cmEscapeQuotes, cmTokenizeSebastian Holtermann2019-08-051-60/+1
|/ | | | | | | | | | 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`)
* cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.hSebastian Holtermann2019-07-291-0/+1
| | | | | This adds the `cmStringAlgorithms.h` header and moves all string functions from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
* cmSystemTool: Let TrimWhitespace accept a cm::string_viewSebastian Holtermann2019-07-281-6/+6
|
* cmSystemTool: Let HelpFileName accept a cm::string_viewSebastian Holtermann2019-07-281-1/+2
|
* cmSystemTool: Let EscapeQuotes accept a cm::string_viewSebastian Holtermann2019-07-281-4/+4
|
* cmSystemTool: Let Expand(ed)ListArgument accept a cm::string_viewSebastian Holtermann2019-07-281-13/+17
|
* Merge topic 'remove_compiler_rpath'Kyle Edwards2019-07-261-2/+6
|\ | | | | | | | | | | | | | | 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
| * Property: Add INSTALL_REMOVE_ENVIROMENT_RPATH propertyJiang Yue2019-07-251-2/+6
| |
* | cmSystemTools: Make IsInternallyOn, IsON and IsOff cm::string_view basedSebastian Holtermann2019-07-241-95/+65
|/
* cmSystemTools: Remove cmSystemTools::FileFormat methodSebastian Holtermann2019-07-041-59/+0
|
* Merge topic 'string-tar'Brad King2019-05-301-6/+6
|\ | | | | | | | | | | | | 57cedb18c0 cmSystemTools: std::string parameters for tar functions Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3392
| * cmSystemTools: std::string parameters for tar functionsVitaly Stakhovsky2019-05-291-6/+6
| |
* | Merge topic 'tar-zstd-compression'Brad King2019-05-301-0/+3
|\ \ | |/ |/| | | | | | | | | 53cb1f2d04 cmake: Teach cmake -E tar command, Zstandard compression Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3357
| * cmake: Teach cmake -E tar command, Zstandard compressionBartosz Kosiorek2019-05-221-0/+3
| | | | | | | | Fixes #18657
* | Merge topic 'selective-tar-extracting-and-listing'Brad King2019-05-241-5/+54
|\ \ | | | | | | | | | | | | | | | | | | c8e217e0a7 cmake: tar: Allow selective extracting and listing of archives Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3342
| * | cmake: tar: Allow selective extracting and listing of archivesBartosz Kosiorek2019-05-231-5/+54
| | |
* | | Use cmAppend to append ranges to std::vector instancesSebastian Holtermann2019-05-231-7/+7
|/ /
* | Merge topic 'string-error'Brad King2019-05-231-30/+15
|\ \ | | | | | | | | | | | | | | | | | | e884b1b693 cmSystemTools::Error(): remove const char* overload Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3360
| * | cmSystemTools::Error(): remove const char* overloadVitaly Stakhovsky2019-05-221-30/+15
| |/
* | cmSystemTools: Remove cmSystemToolsFileTime interfaceSebastian Holtermann2019-05-221-122/+0
|/ | | | | This removes the C style cmSystemToolsFileTime interface in cmSystemTools. It was replaced by the RAII based cmFileTimes class.
* cmSystemTools: Add ExpandedListArgument and ExpandedLists methodsSebastian Holtermann2019-05-131-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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); } } ```
* Ensure stdin, stdout, and stderr pipes are always openBrad King2019-05-021-2/+66
| | | | | | | | | | | | | 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
* cmSystemTools: Remove unused message-related code, simplify logicAlex Turbov2019-04-271-6/+2
|
* cmSystemTools: Fix StringToULong to reject negative numbersBrad King2019-04-111-0/+6
| | | | Fixes: #19161
* Merge topic 'dedup-path-normalization'Brad King2019-03-201-30/+0
|\ | | | | | | | | | | | | | | | | 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
| * cmSystemTools: Drop unused CollapseCombinedPath methodBrad King2019-03-191-30/+0
| | | | | | | | | | | | | | All call sites have been converted to `CollapseFullPath`, so the now-unused `CollapseCombinedPath` can be removed. Fixes: #19050
* | cmake: Don't interrupt archive creation if unable to read a file.Bartosz Kosiorek2019-03-181-6/+4
|/ | | | | | | | | | | 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.
* Merge topic 'cmrange-improvements'Brad King2019-02-251-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | 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
| * cmRange: Move to dedicated header fileRegina Pfeifer2019-02-211-0/+1
| |
* | Merge topic 'error-consolidate'Brad King2019-02-251-6/+6
|\ \ | | | | | | | | | | | | | | | | | | 9dd255548d cmSystemTools::Error: consolidate parameters into single std::string Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2995
| * | cmSystemTools::Error: consolidate parameters into single std::stringVitaly Stakhovsky2019-02-201-6/+6
| |/
* | cmSystemTools: More functions accept `std::string` paramsVitaly Stakhovsky2019-02-201-6/+6
|/
* Merge topic 'delete_copy_assign'Brad King2019-02-181-1/+3
|\ | | | | | | | | | | | | ae5e97a005 Delete some default constructors and assignment operators Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2968
| * Delete some default constructors and assignment operatorsAlbert Astals Cid2019-02-151-1/+3
| | | | | | | | | | | | 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
* | cmSystemTools: Remove redundant cmCopyFile() and Split()Vitaly Stakhovsky2019-02-151-14/+0
|/
* cmSystemTools: More methods accept `std::string` paramsVitaly Stakhovsky2019-02-111-12/+15
|
* Merge topic 'modernize-for-loops'Brad King2019-02-111-5/+3
|\ | | | | | | | | | | | | | | | | 01b2d6ab74 Modernize: Use ranged for-loops when possible 15bdbec017 cmAlgorithms: Make cmRange advance/retreat safe for rvalues Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de> Merge-request: !2901
| * Modernize: Use ranged for-loops when possibleArtur Ryt2019-02-071-5/+3
| | | | | | | | | | | | | | Replaced most manual `const_iterator`-based loops and some reverse-iterator loops with range loops. Fixes: #18858