summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | Merge topic 'message-stdstring'Brad King2019-02-081-3/+3
|\ \ | | | | | | | | | | | | | | | | | | 82edd98300 cmSystemTools: MessageCallback and Message() accept std::string argument Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2929
| * | cmSystemTools: MessageCallback and Message() accept std::string argumentVitaly Stakhovsky2019-02-071-3/+3
| | |
* | | Merge topic 'runsinglecommand'Brad King2019-02-081-2/+3
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | 65baaa0e37 cmSystemTools::RunSingleCommand: Accept std::string argument Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2927
| * | cmSystemTools::RunSingleCommand: Accept std::string argumentVitaly Stakhovsky2019-02-061-2/+3
| |/
* | Prefer front/back/data over dereferencing begin/rbegin iterArtur Ryt2019-02-061-1/+1
|/ | | | Changed for sequenced containers: vector, list, string and array
* cmSystemTools: Let `GetFileFormat` accept a `std::stding const&`Sebastian Holtermann2019-02-021-4/+2
| | | | | The `const char*` used formerly was converted to a `std::string` internally anyway.
* OutputCallback: Accept std::string argumentRegina Pfeifer2019-01-301-2/+2
|
* Merge topic 'functional-callbacks'Brad King2019-01-301-26/+21
|\ | | | | | | | | | | | | | | | | | | 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
| * MessageCallback: Remove unused bool& argumentRegina Pfeifer2019-01-291-1/+1
| |
| * Use `std::function` for callbacksRegina Pfeifer2019-01-291-26/+21
| |
* | cmSystemTools: copy file member functions accept std::string paramsVitaly Stakhovsky2019-01-291-7/+2
|/ | | | | Cleaned up `c_str()`s. `cmSystemTools::CopyFileIfDifferent()` removed as redundant.
* cmSystemTools::Message: Add overload accepting std::stringVitaly Stakhovsky2019-01-281-2/+2
|
* Merge topic 'renamefile-string'Brad King2019-01-251-2/+3
|\ | | | | | | | | | | | | 9e5c13738b cmSystemTools::RenameFile: Accepts std::string args Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2842
| * cmSystemTools::RenameFile: Accepts std::string argsVitaly Stakhovsky2019-01-231-2/+3
| |
* | cmSystemTools::Error(): new overload accepting std::stringVitaly Stakhovsky2019-01-231-6/+13
|/
* Merge topic 'stdout-string'Brad King2019-01-221-24/+12
|\ | | | | | | | | | | | | 3132ea801c cmSystemTools: Stdout(),Stderr() accept std::string argument Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2829
| * cmSystemTools: Stdout(),Stderr() accept std::string argumentVitaly Stakhovsky2019-01-201-24/+12
| |
* | Merge topic 'use-emplace'Brad King2019-01-211-3/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | ef61997b1b clang-tidy: Use emplace 2e5307a2a4 CTestSVN: Accept std::string in SVNInfo constructor Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2811
| * | clang-tidy: Use emplaceRegina Pfeifer2019-01-171-3/+3
| |/
* | cmSystemTools: Silence CreateLink and CreateSymlink errorsTushar Maheshwari2019-01-161-4/+14
| | | | | | | | | | If provided, report errors to a std::string. This allows "silent" fallback to another flow, like COPY_ON_ERROR.
* | cmFileCommand: Add CREATE_LINK subcommandTushar Maheshwari2019-01-161-0/+16
|/ | | | | | | | | | | | | | 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
* cmOutputConverter: Moved ForceToRelativePath to cmSystemBruno Manganelli2018-12-071-0/+75
|
* cmSystemTools: Add EncodeURL helperBrad King2018-11-281-0/+29
| | | | | | | Factor a URL encoding implementation out of CTest. Add an option to not escape slashes. Suggested-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Mark operator bool explicitRegina Pfeifer2018-11-191-1/+4
|
* Using front() and back() instead of calculationsCengizhan Pasaoglu2018-11-061-2/+2
|
* Merge topic 'tar-warnings'Brad King2018-10-251-13/+31
|\ | | | | | | | | | | | | 95c8a03f00 cmake: Distinguish '-E tar' warnings from errors copying data Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2519
| * cmake: Distinguish '-E tar' warnings from errors copying dataBrad King2018-10-241-13/+31
| | | | | | | | | | | | | | | | The logic added by commit v3.12.0-rc1~62^2 (cmake: Teach '-E tar' to report errors copying data, 2018-05-16) incorrectly reports failure in the case of ARCHIVE_WARN. Convert this case to a warning. Fixes: #18496
| * Merge branch 'restore-windows-resources-through-link' into release-3.12Brad King2018-06-131-1/+2
| |\ | | | | | | | | | Merge-request: !2147
* | | Fix misc. typosluz.paz2018-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via `codespell -q 3 -I ../cmake-whitelist.txt --skip="./Utilities"` where the whitelist consists of ``` aci ans behaviour buil convertor dum earch ect emmited emmitted helpfull iff isnt ith lowercased mose nd nknown nto objext ot pathes pevents splitted substract superceded supercedes te tim todays uint upto whitespaces ```
* | | cmake: Add '-E create_symlink' support on WindowsJon Chronopoulos2018-09-181-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | cmSystemTools: Re-implement IsOn,IsOff with manual branchingBrad King2018-08-311-35/+56
| | | | | | | | | | | | | | | | | | Replace use of std::string allocation, std::set lookups, and toupper conversions with explicit manual logic to do case-insensitive recognition of a specific set of strings.
* | | cmSystemTools: Add IsOn(),IsOff() overloads accepting std::stringVitaly Stakhovsky2018-08-311-0/+10
| | |