summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.h
Commit message (Collapse)AuthorAgeFilesLines
* Reduce raw string pointers usage.Pavel Solodovnikov2018-01-311-2/+3
| | | | | | | | | | * Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
* Merge topic 'ctest-chrono'Brad King2018-01-261-3/+4
|\ | | | | | | | | | | | | | | | | e6a80ccf Make use of std::chrono throughout every component ff62b005 CTest: add safe conversion from cmDuration to integer types 695951bc CTest: introduce cmDuration Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1592
| * Make use of std::chrono throughout every componentWouter Klouwen2018-01-231-3/+4
| | | | | | | | | | | | | | | | This commit continues the changes made in CTest to support std::chrono by applying it throughout every component where a duration was used. No functional change intended.
* | Extend libuv file translate mode workaround to all executablesBrad King2018-01-231-0/+4
|/ | | | | | | | | | | | | | | Since libuv commit v1.14.1~7 (win: add uv__once_init() calls, 2017-08-30) the libuv initialization of the file translate mode may take place even if we do not use a uv loop. This change was included in our libuv update commit f4a26c748b (libuv 2018-01-19). Therefore use of libuv even through `cmSystemTools::GetRealPath` in any executable may trigger its file translate mode setting. Factor out the logic added to `cmake.exe` by commit v3.9.0-rc4~10^2 (cmake: Fix default file translate mode when using libuv, 2017-06-13) and re-use to initialize all executables. Issue: #16962
* Merge topic 'add_cuda_to_source_regex'Craig Scott2018-01-091-0/+1
|\ | | | | | | | | | | | | | | 81868e6b CUDA: Add cu as default source file extension Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Brad King <brad.king@kitware.com> Merge-request: !1629
| * CUDA: Add cu as default source file extensionRobert Maynard2018-01-081-0/+1
| |
* | Various typo fixesLuz Paz2018-01-031-3/+3
|/ | | | Some are user-facing. Others are source comments.
* cmSystemTools: Implement GetRealPath on WindowsManuel Núñez2017-10-241-0/+4
| | | | | | | Override the KWSys GetRealPath on Windows and use uv_fs_realpath first to resolve symbolic links. Fixes: #17206
* get_filename_component: Revise PROGRAM/PROGRAM_ARGS split semanticsBrad King2017-09-131-0/+5
| | | | | | | | | | | | | | | | | | | | The KWSys `SystemTools::SplitProgramFromArgs` implementation goes into an infinite loop when the value is just " " (a space). Since the "program path with unquoted spaces plus command-line arguments" operation it is trying to provide is poorly defined (string parsing should not depend on filesystem content), just stop using it. Instead consider the main two use cases the old approach tried to handle: * The value is the name or absolute path of a program with no quoting or escaping, but also no command-line arguments. In this case we can use the value as given with no parsing, and assume no arguments. * The value is a command-line string containing the program name/path plus arguments. In this case we now assume that the command line is properly quoted or escaped. Fixes: #17262
* IWYU: Mark cmConfigure.h with pragma: keepDaniel Pfeifer2017-08-261-1/+1
| | | | Also remove `#include "cmConfigure.h"` from most source files.
* Use C++11 nullptrDaniel Pfeifer2017-08-241-20/+19
|
* Change ComputeFileMD5 to ComputeFileHashAndré Klitzing2017-07-141-2/+4
| | | | | | | * Use a parameter to select hash algorithm * Return a std::string as result or an empty string if it fails * Avoids unnecessary copy of hash value
* Merge topic 'ninja-dyndep-response-file'Brad King2017-04-251-0/+7
|\ | | | | | | | | | | | | 594d3d6f Ninja: support response file for cmake_ninja_depends on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !722
| * Ninja: support response file for cmake_ninja_depends on WindowsBernhard Burgermeister2017-04-251-0/+7
| | | | | | | | | | | | | | The internal tool "cmake_ninja_depends" now supports reading the list of ddi files from a reponse file to circumvent Windows command line length limits. Use this response file for dyndep rule on Windows.
* | Use CM_DISABLE_COPYDaniel Pfeifer2017-04-241-4/+2
| |
* | cmSystemTools::SaveRestoreEnvironment: make noncopyableDaniel Pfeifer2017-04-211-1/+4
|/ | | | Also, make the destructor non-virtual.
* Ninja,Makefile: Unify command line limit logicChristian Pfeiffer2017-04-191-0/+2
| | | | | | Move the logic to cmSystemTools to be shared among the generators. Revise the implementation and add comments justifying each possible source for a limit.
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-3/+3
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* Add self-sufficient wrapper for <sys/stat.h>Daniel Pfeifer2017-03-241-6/+0
|
* IWYU: use pragma exportDaniel Pfeifer2017-03-231-1/+1
|
* Add Encoding option for RunChild, RunMakeCommand and RunProcessDāvis Mosāns2016-11-141-1/+4
|
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-0/+6
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* cmSystemTools: Add strverscmpBrad King2016-09-131-0/+10
| | | | | | | | | | Add support for natural string order by comparing non-numerical character directly and numerical number by firstly collecting contiguous digits. The order is defined by the `strverscmp(3)` manual [1]. [1] http://man7.org/linux/man-pages/man3/strverscmp.3.html Inspired-by: Pierluigi Taddei <pierluigi.taddei@gmail.com>
* fix a batch of include-what-you-use violationsDaniel Pfeifer2016-08-161-1/+4
|
* Add additional <= and >= comparison operatorsChuck Atkins2016-08-091-3/+7
| | | | | This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION equivalents to use the combined <= and >= functionality.
* use CM_NULLPTRDaniel Pfeifer2016-06-281-17/+23
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-75/+60
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Fix spelling typos in comments and documentation (#16037)Felix Geyer2016-03-291-1/+1
| | | | | The Debian package checker tool (lintian) detected several typos in CMake.
* cmSystemTools: Rename OUTPUT_NORMAL to OUTPUT_FORWARD to clarify its purposeBrad King2016-01-191-2/+2
| | | | | | The OUTPUT_NORMAL value is not really "normal" and has only one caller. Rename it to OUTPUT_FORWARD to clarify that we are explicitly forwarding the output.
* cmSystemTools: Add VersionCompareEqual helperBrad King2016-01-111-0/+2
| | | | Wrap a call to VersionCompare with OP_EQUAL.
* cmSystemTools: Add VersionCompareGreater helperGilles Khouzam2015-10-021-0/+2
| | | | | Wrap a call to VersionCompare with OP_GREATER in a signature suitable for use with std::sort.
* Ninja: Refactor lookup of cmcldeps locationBrad King2015-09-181-0/+1
| | | | | This executable comes with CMake so just compute its location in cmSystemTools instead of storing it in compiler information modules.
* cmSystemTools: Drop unused StringEndsWith methodBrad King2015-09-021-2/+0
| | | | It has no callers and we can inherit one from KWSys SystemTools anyway.
* VS: Windows Store/Phone package cert thumbprintGilles Khouzam2015-08-271-0/+3
| | | | | Add the PackageCertificateThumbprint property when there is a certificate on a WindowsStore or Phone app.
* cmOutputConverter: Adopt EscapeWindowsShellArgument methodBrad King2015-07-081-5/+0
| | | | Move it out of cmSystemTools and into cmOutputConverter.
* cmSystemTools: Add StringToULong helperBrad King2015-06-301-0/+1
| | | | Convert a string to an unsigned integer and reject any extra input.
* cmSystemTools: Teach RunSingleCommand to separate stdout and stderrBrad King2015-04-201-2/+5
| | | | | | | Extend the RunSingleCommand signature to capture stdout and stderr separately. Allow both to be captured to the same std::string to preserve existing behavior. Update all call sites to do this so that this refactoring does not introduce functional changes.
* cmake: Teach "-E tar" command a "--format=" optionNils Gladitz2015-04-101-1/+2
| | | | | | | Allows specifying a libarchive defined archive format currently restricted to 7zip, gnutar, pax, paxr and zip. The default is "paxr" (pax restricted).
* bootstrap: Enable color Makefile outputBrad King2015-02-051-2/+0
| | | | | | Build the needed infrastructure during bootstrap in order to allow "cmake -E cmake_echo_color" to be used unconditionally during generation.
* cmake: Teach "-E tar" command a "--mtime=" optionBrad King2015-01-191-3/+3
| | | | | | | | | | Add an option to set the mtime of entries in a tarball so that one can create a tarball with a consistent content hash (e.g. MD5) for a given set of files regardless of their current timestamps on disk. This will be useful for submission of tarballs to CDash, which tracks content hashes to avoid duplication. Inspired-by: Bill Hoffman <bill.hoffman@kitware.com>
* cmSystemTools: use an enumeration for compression formatsBen Boeckel2015-01-121-4/+11
| | | | Juggling 3 booleans was unwieldy.
* cmake -E tar: add support for .xz files with 'J'Ben Boeckel2015-01-091-1/+1
|
* file: Use 'long' to represent the parsed LOCK TIMEOUT valueRuslan Baratov2014-12-051-2/+2
| | | | | | | | | Convert the StringToInt helper into a StringToLong helper with a 'long' result type. This will make the helper more useful to other callers that want to use strtol. While at it, also check errno after calling strtol in case the conversion fails with a range error.
* cmSystemTools: Add StringToInt helperRuslan Baratov2014-12-031-0/+3
| | | | | | Convert a string to a signed integer and reject any extra input. Co-Author: Rolf Eike Beer <eike@sf-mail.de>
* cmSystemTools: Add callback for StderrBrad King2014-05-151-6/+11
| | | | | | | | | Factor a common callback type out of StdoutCallback. Add an equivalent StderrCallback. While at it, use "size_t" for the data length instead of "int". Teach "ctest --build-and-test" to capture the Stderr callback because output sent through it is part of the logical CMake process output.
* cmSystemTools: Rename ErrorCallback to MessageCallbackBrad King2014-05-151-4/+4
| | | | | Clarify that it is the callback for the cmSystemTools::Message API. Rename callback clients too.
* strings: Remove cmStdString referencesBen Boeckel2014-03-081-12/+5
| | | | | | | | | | | Casts from std::string -> cmStdString were high on the list of things taking up time. Avoid such implicit casts across function calls by just using std::string everywhere. The comment that the symbol name is too long is no longer relevant since modern debuggers alias the templates anyways and the size is a non-issue since the underlying methods are generated since it's inherited.
* stringapi: Take strings in escaping functionsBen Boeckel2014-03-081-1/+1
|