summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * cmSystemTools: Skip ComputeCertificateThumbprint during bootstrapBrad King2015-09-021-1/+1
| | | | | | | | | | The implementation of this method requires linking to some extra system libraries. Simply leave it out of the bootstrap-built CMake.
* | Merge topic 'vs-store-phone-cert-thumbs'Brad King2015-09-011-7/+8
|\ \ | |/ | | | | | | e0cf77b3 cmSystemTools: Use CreateFileW explicitly to pass wchar_t path
| * cmSystemTools: Use CreateFileW explicitly to pass wchar_t pathBrad King2015-08-311-7/+8
| | | | | | | | | | | | | | The call to CreateFile added by commit ac0bb433 (VS: Windows Store/Phone package cert thumbprint, 2015-08-21) passes a wide character path explicitly so we should call CreateFileW directly. Otherwise it does not build without -DUNICODE (e.g. in bootstrap on MSYS).
* | Merge topic 'makefile-color-when-needed'Brad King2015-08-311-1/+1
|\ \ | | | | | | | | | | | | bfb9d34f Makefile: Print color escapes only when necessary
| * | Makefile: Print color escapes only when necessaryBrad King2015-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach cmSystemTools::MakefileColorEcho to use the color printing API only when we actually have a color to print. This avoids printing escape sequences that do not change the text attributes. Since commit v3.3.0-rc1~480^2~4 (Makefile: Fix output during parallel builds, 2015-02-05) we always use this code path to print progress and rule messages even when color is disabled (e.g. in a try_compile). It is important to avoid printing escapes when there is no color because on MSYS we have no isatty and so assume that vt100 escapes are supported, but we do not want to print them when capturing try_compile output. If we capture the vt100 escapes in try_compile output, they contain unbalanced square brackets. This causes CMakeParseImplicitLinkInfo to fail to separate lines in a ;-list and therefore fail to extract information from the link line. Then mixed-language linking breaks.
* | | Merge topic 'vs-store-phone-cert-thumbs'Brad King2015-08-311-0/+88
|\ \ \ | | |/ | |/| | | | | | | | | | ac0bb433 VS: Windows Store/Phone package cert thumbprint 92b835ec Simplify condition for using rpcrt4 library on Windows
| * | VS: Windows Store/Phone package cert thumbprintGilles Khouzam2015-08-271-0/+88
| | | | | | | | | | | | | | | Add the PackageCertificateThumbprint property when there is a certificate on a WindowsStore or Phone app.
* | | Merge topic 'libarchive-modern-apis'Brad King2015-08-251-2/+2
|\ \ \ | | | | | | | | | | | | | | | | e7f93715 Use modern libarchive APIs
| * | | Use modern libarchive APIsPáder Rezső2015-08-241-2/+2
| |/ / | | | | | | | | | | | | Replace use of deprecated libarchive3 functions with their modern equivalents.
* | | Remove use of include <cmsys/stl/*> and cmsys_stl::*Brad King2015-08-201-1/+0
| | | | | | | | | | | | We no longer need this compatibility layer for the compilers we support.
* | | Remove use of include <cmsys/ios/*> and cmsys_ios::*Brad King2015-08-201-1/+1
|/ / | | | | | | We no longer need this compatibility layer for the compilers we support.
* | cmSystemTools: Use extended length paths for Windows apis.Clinton Stimpson2015-08-151-8/+11
| |
* | cmOutputConverter: Adopt EscapeWindowsShellArgument methodBrad King2015-07-081-19/+0
| | | | | | | | Move it out of cmSystemTools and into cmOutputConverter.
* | cmSystemTools: Add StringToULong helperBrad King2015-06-301-0/+9
|/ | | | Convert a string to an unsigned integer and reject any extra input.
* cmSystemTools: Fix IsPathToFramework implementation (#15535)Brad King2015-04-271-9/+2
| | | | | | | | Use more reliable logic to detect if a path ends in ".framework". The old logic added by commit v2.4.0~791 (add better support for framework linking, 2005-12-26) did not account for paths not ending in it at all. With a 9-character path the logic and "npos == -1" happens to make the old check pass.
* cmSystemTools: Teach RunSingleCommand to separate stdout and stderrBrad King2015-04-201-19/+44
| | | | | | | 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-2/+5
| | | | | | | Allows specifying a libarchive defined archive format currently restricted to 7zip, gnutar, pax, paxr and zip. The default is "paxr" (pax restricted).
* cmAlgorithms: Add cmWrap.Stephen Kelly2015-02-201-1/+1
| | | | | | | | | | | | | Port some existing cmJoin to use it. cmJoin is cumbersome to use in cases where the objective is to somehow 'quote' each item and then join it with a separator. In that case, the joiner string is harder to read and reason about. cmWrap aims to solve that. Provide an overload taking char wrappers to simplify the case of surrounding every element in quotes without needing to escape the quote character.
* Split cmAlgorithms into a separate header file.Stephen Kelly2015-02-101-0/+1
|
* Merge topic 'use-algorithms'Brad King2015-02-101-2/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | d8639733 cmSystemTools: Remove unnecessary comparison. 803317aa cmSystemTools: Early return if size makes later comparison false. 11093a03 Replace temporary bool by inlining warning condition. 6cd2ee95 Replace loop with member algorithm. 94e993a0 cmComputeLinkDepends: Remove temporary iterator copy. 69dbe51b Replace loop with algorithm. 683fafea Replace a loop with std::transform. 63f584b6 Replace while loop with member insert. 74c4d9d2 Take a size check outside of an inner loop. 71d47115 Use insert member instead of back_inserter. 39622c99 Convert while loop to member insert. a7fcc148 Convert loop to algorithm. d46c4f07 Extract a prefix variable from loop. d59913f0 Take computation out of loop. 3f3db744 cmMakefile: Remove ExpandSourceListArguments. bd990c80 Remove use of ExpandSourceListArguments. ...
| * cmSystemTools: Remove unnecessary comparison.Stephen Kelly2015-02-061-1/+1
| | | | | | | | We already know the string is uppercase.
| * cmSystemTools: Early return if size makes later comparison false.Stephen Kelly2015-02-061-0/+4
| |
| * Remove use of cmsys_stl.Stephen Kelly2015-02-051-1/+1
| | | | | | | | It is not needed.
* | Merge topic 'makefile-progress-improvements'Brad King2015-02-101-6/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 63668954 Help: Add notes for topic 'makefile-progress-improvements' ae775fe8 Makefile: Change link step message color to bold green 7bb50e4a Makefile: Add progress to link step messages c6ada827 Makefile: Print all color escape sequences before newline 8521fdf5 Makefile: Fix output during parallel builds (#12991) 69ac6d27 bootstrap: Enable color Makefile output
| * | Makefile: Print all color escape sequences before newlineBrad King2015-02-061-3/+9
| | | | | | | | | | | | Ensure that the escape sequences do not leak across lines.
| * | bootstrap: Enable color Makefile outputBrad King2015-02-051-3/+1
| |/ | | | | | | | | | | Build the needed infrastructure during bootstrap in order to allow "cmake -E cmake_echo_color" to be used unconditionally during generation.
* | Merge branch 'backport-no-global-setlocale' into no-global-setlocaleBrad King2015-02-061-0/+3
|\ \ | |/ |/| | | Resolve conflict in Source/CMakeLists.txt by taking both changes.
| * Add setlocale() calls around use of libarchive APIs (#14934, #15377)Brad King2015-02-061-0/+3
| | | | | | | | | | | | | | | | | | | | The libarchive APIs use nl_langinfo(CODESET) for iconv so they need the locale to be set for LC_CTYPE. However, the rest of CMake does not define any behavior for non-ASCII character classification/conversion so we do not want to setlocale() globally. Add a RAII class to save, set, and restore the locale around calls to libarchive APIs. Inspired-by: Clinton Stimpson <clinton@elemtech.com>
* | cmake: Teach "-E tar" command a "--mtime=" optionBrad King2015-01-191-1/+2
| | | | | | | | | | | | | | | | | | | | 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>
* | Replace 'foo.size() == 0' pattern with foo.empty().Stephen Kelly2015-01-181-1/+1
| |