summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'iwyu'Brad King2017-02-201-0/+1
|\ | | | | | | | | | | | | | | | | | | | | d58d28a9 ParserHelper: Move macros to bottom of files 07953c18 remove file cmStandardIncludes.h f918b053 cmFortranParser: include what you use b74314c6 cmDependsJavaParser: include what you use 74404df4 cmCommandArgumentParser: include what you use e7168c08 cmExprParser: include what you use ee72803e fix some include-what-you-use diagnostics
| * fix some include-what-you-use diagnosticsDaniel Pfeifer2017-02-171-0/+1
| |
* | Make CMAKE_ROOT independent of case of path used to invoke cmakeBrad King2017-02-171-2/+2
|/ | | | | | | | | | | | | | We compute the location of `CMAKE_ROOT` and other resources relative to the location of our own executable. On some platforms this path is computed in a way that depends on the case of the path used to invoke the executable. Convert the result to the actual case preserved by the filesystem on disk in order to make it consistent regardless of how the executable is launched. This approach generalizes the fix made by commit v3.8.0-rc1~71^2 (cmSystemTools: use the actual case for root detection, 2017-01-18). Issue: #16648
* Merge topic 'case-insensitive-bindir-detection'Brad King2017-01-201-1/+2
|\ | | | | | | | | 7f0a21a5 cmSystemTools: use the actual case for root detection
| * cmSystemTools: use the actual case for root detectionBen Boeckel2017-01-181-1/+2
| | | | | | | | | | | | | | | | | | On Windows, calling a binary installed with the default `bin` binary directory will fail to be detected when called as `BIN\cmake.exe` due to the string compare. Get the actual case of the path before checking that the path ends with `CMAKE_BIN_DIR`. Fixes #16574.
* | clang-tidy: apply modernize-use-bool-literals fixesDaniel Pfeifer2016-12-121-1/+1
| |
* | Add Encoding option for RunChild, RunMakeCommand and RunProcessDāvis Mosāns2016-11-141-2/+2
| |
* | Windows: Encode child process output to internally-used encodingDāvis Mosāns2016-11-141-4/+39
| | | | | | | | | | | | Typically Windows applications (eg. MSVC compiler) use current console's codepage for output to pipes so we need to encode that to our internally-used encoding (`KWSYS_ENCODING_DEFAULT_CODEPAGE`).
* | Port hash computation to cmCryptoHashBrad King2016-11-101-4/+4
| | | | | | | | | | Avoid using KWSys MD5 or `cm_sha2` and use the `cmCryptoHash` abstraction instead.
* | cmCryptoHash: Avoid using subclasses at client sitesBrad King2016-11-101-4/+4
| | | | | | | | Use only the main `cmCryptoHash` interface.
* | cmSystemTools: Flush output buffer for list_item_verboseDāvis Mosāns2016-10-131-0/+1
| | | | | | | | | | When `std::cout` and `FILE *stdout` are used at same time need to explicitly flush otherwise they can be out of sync.
* | cmSystemTools, elf: handle DT_MIPS_RLD_REL_MAP in RemoveRPathJames Cowgill2016-10-071-0/+24
| |
* | cmSystemTools: rewrite RemoveRPath using DyanmicEntryList methodsJames Cowgill2016-10-071-35/+17
|/
* 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.
* Merge topic 'add-strverscmp'Brad King2016-09-151-0/+77
|\ | | | | | | | | | | 88494325 Tests: Add test for our strverscmp implementation 07f69bd5 cmSystemTools: Add strverscmp
| * cmSystemTools: Add strverscmpBrad King2016-09-131-0/+77
| | | | | | | | | | | | | | | | | | | | 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>
* | cmSystemTools: simplify boolean expressionsDaniel Pfeifer2016-09-121-15/+5
|/
* surround macro arguments with parenthesesDaniel Pfeifer2016-09-051-1/+1
|
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-30/+36
|
* CMake: don't use else after returnDaniel Pfeifer2016-08-181-13/+13
|
* Make sure unnused parameters are /*named*/Daniel Pfeifer2016-08-161-1/+2
|
* Add additional <= and >= comparison operatorsChuck Atkins2016-08-091-3/+10
| | | | | This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION equivalents to use the combined <= and >= functionality.
* Use better KWSys SystemTools::GetEnv and HasEnv signaturesDāvis Mosāns2016-07-181-3/+3
|
* use CM_NULLPTRDaniel Pfeifer2016-06-281-13/+14
|
* Add missing braces around statements.Daniel Pfeifer2016-06-101-4/+6
| | | | | Apply fixits of clang-tidy's readability-braces-around-statements checker.
* Merge topic 'size-empty'Brad King2016-06-031-1/+1
|\ | | | | | | | | c6220de2 Use the empty() method to check for emptyness.
| * Use the empty() method to check for emptyness.Daniel Pfeifer2016-06-021-1/+1
| | | | | | | | | | Apply fix-its from clang-tidy's readability-container-size-empty checker.
* | Merge topic 'simplify-boolean-expressions'Brad King2016-06-031-5/+2
|\ \ | |/ |/| | | | | 7f6b8d33 Simplify boolean expressions
| * Simplify boolean expressionsDaniel Pfeifer2016-06-021-5/+2
| | | | | | | | | | | | Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes.
* | Add option to control 'bin' directory of CMake's own installation (#16076)Nicolas BUNEL2016-06-011-7/+14
|/ | | | | Add a `CMAKE_BIN_DIR` cache entry to CMake's own build configuration. Add a `--bindir` option to the `bootstrap` script to set it.
* Merge topic 'style-cmSystemTools'Brad King2016-05-261-1/+1
|\ | | | | | | | | 8e801eb5 cmSystemTools: Fix indentation typo
| * cmSystemTools: Fix indentation typoBrad King2016-05-251-1/+1
| |
* | Improve string find: prefer character overloads.Daniel Pfeifer2016-05-241-1/+1
|/ | | | | Apply fix-its from clang-tidy's performance-faster-string-find checker. Ignore findings in kwsys.
* Fix support for large RPATH updates (#16105)Brad King2016-05-191-26/+22
| | | | | Avoid using a KWSys RegularExpression to search for RPATH substrings. It cannot handle large expressions.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-1355/+948
| | | | | | | | | | | | | 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.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-40/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Source: Sort includes of sys/types.h as clang-format wouldBrad King2016-05-031-1/+1
| | | | | When this header is included in blocks where order does not matter, just place it in lexicographic order as clang-format would by default.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Source: Stabilize include orderBrad King2016-04-291-1/+2
| | | | | Each source file has a logical first include file. Include it in an isolated block so that tools that sort includes do not move them.
* cmSystemTools: Avoid excess entropy consumption by RandomSeed (#15976)Cristian Rodríguez2016-02-191-2/+4
| | | | Read `/dev/urandom` without buffering to avoid taking more than we need.
* cmSystemTools: Remove unused include <fcntl.h>Brad King2016-02-191-2/+1
| | | | | We do not seem to need this header anymore, and including it on AIX causes `#define open open64` which breaks `std::ifstream::open` calls.
* cmSystemTools: Teach RunSingleCommand to merge child pipes when possibleBrad King2016-01-191-23/+21
| | | | | | | | | Audit the code to make sure there are no callers that use OUTPUT_MERGE with separate capture strings. Then change RunSingleCommand to implement output merging by giving the child process a single pipe for both its stdout and stderr descriptors. This will more cleanly merge the content on atomic write boundaries in the child instead of on arbitrary buffering boundaries in the parent.
* cmSystemTools: Simplify RunSingleCommand output string constructionBrad King2016-01-191-13/+4
| | | | | | Assign to the result strings instead setting to empty and appending. The old approach was left from when we directly buffered output in the strings.
* cmSystemTools: Drop redundant condition in RunSingleCommandBrad King2016-01-191-9/+7
| | | | | The output processing loop is already guarded by a condition so we do not need to repeat the condition inside the loop.
* install: Do not remove compiler-defined RPATH entriesLior Goldberg2016-01-151-1/+26
| | | | | | | | | | | | | | | | | | Some compilers may add their own RPATH entries when invoking the linker. For example, a GCC installation may contain the following definition in the specs file: *link_libgcc: %D -rpath <<some specific rpath in which libstdc++.so can be found>> In this case binaries may contain RPATH entries that CMake did not add. When we update the RPATH on installation we must preserve these entries even if CMake thinks the INSTALL_RPATH value should be empty. Fix this by always using file(RPATH_CHANGE) and teach it to behave as file(RPATH_REMOVE) if the actual RPATH in the file is empty after replacing the build-tree RPATH with the install-tree RPATH. This will preserve any compiler-added RPATH value instead of removing it.
* Merge topic 'vs-win10-sdk'Brad King2016-01-121-0/+8
|\ | | | | | | | | | | | | a57caf7e VS: Fix Windows 10 SDK version selection (#15831) ad594de8 cmSystemTools: Add VersionCompareEqual helper c173e37f VS: Do not select a partial Windows 10 SDK folder (#15831)
| * cmSystemTools: Add VersionCompareEqual helperBrad King2016-01-111-0/+8
| | | | | | | | Wrap a call to VersionCompare with OP_EQUAL.
* | cmSystemTools: Preemptively adapt to future libarchive 4.0 changesBrad King2015-10-281-0/+3
|/
* cmSystemTools: Add VersionCompareGreater helperGilles Khouzam2015-10-021-0/+8
| | | | | Wrap a call to VersionCompare with OP_GREATER in a signature suitable for use with std::sort.