summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* SystemTools: time operations on directoriesDomen Vrankar2015-09-281-4/+7
| | | | | On windows FILE_FLAG_BACKUP_SEMANTICS enables us to read/write time both on files and directories.
* SystemTools: set time file permissionsDomen Vrankar2015-09-281-2/+2
| | | | | | On Windows if file permissions are read only FILE_WRITE_ATTRIBUTES will enables us to get file handle and change file time.
* Revert topic 'cpack-package-empty-dirs'Brad King2015-09-251-21/+0
| | | | | | | | | The changes in commit 47b060ae (CPackDeb: allow empty directories in component packages, 2015-09-21), commit b58de9fe (CPack: allow packaging of empty directories, 2015-09-21), and commit b761e90d (CPack: remove accidental changes, 2015-09-22) regressed packaging of CMake itself. Revert the changes until they can be revised and rebased on other changes that make additional fixes.
* CPack: allow packaging of empty directoriesDomen Vrankar2015-09-221-0/+21
|
* Ninja: Refactor lookup of cmcldeps locationBrad King2015-09-181-0/+14
| | | | | This executable comes with CMake so just compute its location in cmSystemTools instead of storing it in compiler information modules.
* cmSystemTools: Fix TrimWhitespace for non-ascii strings (#15735)Brad King2015-09-101-2/+2
| | | | | | | | Since commit v2.8.11~59^2 (cmSystemTools: Generalize TrimWhitespace to all whitespace, 2013-03-27) we incorrectly use `c <= ' '` to determine if `c` is a whitespace character. With a signed `char` type UTF-8 encoded strings may be truncated because values above 0x7f appear negative and therefore less than 0x20. Use `isspace(c)` instead.
* cmSystemTools: Factor out a cm_isspace helperBrad King2015-09-101-1/+6
| | | | | | Extract the logic added by commit v3.1.0-rc1~386^2 (Encoding: Fix debug asserts ... with non-ascii chars, 2014-06-16) into a helper function so we can re-use it.
* Merge topic 'find_program-NAMES_PER_DIR'Brad King2015-09-081-9/+0
|\ | | | | | | | | | | | | | | | | | | 8ea7611b find_program: Optionally consider all names in each directory fc1990c9 cmFindProgramCommand: Re-implement search using more flexible approach fdbfc9f6 Tests: Add explicit testing for find_program 907a919b cmSystemTools: Drop unused StringEndsWith method ed4de3c9 cmFindProgramCommand: Use Names member instead of passing it bf32b95e cmFindLibraryCommand: Avoid repeating search for the same name
| * cmSystemTools: Drop unused StringEndsWith methodBrad King2015-09-021-9/+0
| | | | | | | | It has no callers and we can inherit one from KWSys SystemTools anyway.
* | Merge topic 'vs-store-phone-cert-thumbs'Brad King2015-09-031-1/+1
|\ \ | |/ |/| | | | | 7c33b0f9 cmSystemTools: Skip ComputeCertificateThumbprint during bootstrap