Commit Graph

572 Commits

Author SHA1 Message Date
Brad King 9c4a500f75 cmSystemTools: Fix TrimWhitespace for non-ascii strings (#15735)
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.
2015-09-10 10:05:21 -04:00
Brad King 87a9061d57 cmSystemTools: Factor out a cm_isspace helper
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.
2015-09-10 10:04:20 -04:00
Brad King 4da3315db3 Merge topic 'find_program-NAMES_PER_DIR'
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
2015-09-08 10:24:36 -04:00
Brad King 18252b5887 Merge topic 'vs-store-phone-cert-thumbs'
7c33b0f9 cmSystemTools: Skip ComputeCertificateThumbprint during bootstrap
2015-09-03 06:49:55 -04:00
Brad King 907a919be1 cmSystemTools: Drop unused StringEndsWith method
It has no callers and we can inherit one from KWSys SystemTools anyway.
2015-09-02 10:17:21 -04:00
Brad King 7c33b0f9a6 cmSystemTools: Skip ComputeCertificateThumbprint during bootstrap
The implementation of this method requires linking to some extra system
libraries.  Simply leave it out of the bootstrap-built CMake.
2015-09-02 09:23:45 -04:00
Brad King 0e08ab6ef1 Merge topic 'vs-store-phone-cert-thumbs'
e0cf77b3 cmSystemTools: Use CreateFileW explicitly to pass wchar_t path
2015-09-01 09:53:28 -04:00
Brad King e0cf77b310 cmSystemTools: Use CreateFileW explicitly to pass wchar_t path
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).
2015-08-31 16:33:46 -04:00
Brad King 51d7a7bb3f Merge topic 'makefile-color-when-needed'
bfb9d34f Makefile: Print color escapes only when necessary
2015-08-31 09:48:42 -04:00
Brad King 08ae6ced4d Merge topic 'vs-store-phone-cert-thumbs'
ac0bb433 VS: Windows Store/Phone package cert thumbprint
92b835ec Simplify condition for using rpcrt4 library on Windows
2015-08-31 09:48:39 -04:00
Brad King bfb9d34f8a Makefile: Print color escapes only when necessary
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.
2015-08-28 15:16:05 -04:00
Gilles Khouzam ac0bb4333d VS: Windows Store/Phone package cert thumbprint
Add the PackageCertificateThumbprint property when there is a
certificate on a WindowsStore or Phone app.
2015-08-27 13:35:18 -04:00
Brad King 96dafff97f Merge topic 'libarchive-modern-apis'
e7f93715 Use modern libarchive APIs
2015-08-25 15:13:31 -04:00
Páder Rezső e7f937155f Use modern libarchive APIs
Replace use of deprecated libarchive3 functions with their modern
equivalents.
2015-08-24 10:40:04 -04:00
Brad King e8585f45f5 Remove use of include <cmsys/stl/*> and cmsys_stl::*
We no longer need this compatibility layer for the compilers we support.
2015-08-20 16:19:08 -04:00
Brad King 6db713c07f Remove use of include <cmsys/ios/*> and cmsys_ios::*
We no longer need this compatibility layer for the compilers we support.
2015-08-20 16:19:08 -04:00
Clinton Stimpson e06ea8373f cmSystemTools: Use extended length paths for Windows apis. 2015-08-14 23:14:06 -06:00
Brad King bb7eefe4dd cmOutputConverter: Adopt EscapeWindowsShellArgument method
Move it out of cmSystemTools and into cmOutputConverter.
2015-07-08 09:00:00 -04:00
Brad King 8bf5a80b96 cmSystemTools: Add StringToULong helper
Convert a string to an unsigned integer and reject any extra input.
2015-06-30 10:21:37 -04:00
Brad King c46490dad5 cmSystemTools: Fix IsPathToFramework implementation (#15535)
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.
2015-04-27 11:49:29 -04:00
Brad King 356c26ebdf cmSystemTools: Teach RunSingleCommand to separate stdout and stderr
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.
2015-04-20 15:47:50 -04:00
Nils Gladitz d2cc580704 cmake: Teach "-E tar" command a "--format=" option
Allows specifying a libarchive defined archive format currently restricted to
7zip, gnutar, pax, paxr and zip.

The default is "paxr" (pax restricted).
2015-04-10 08:32:31 -04:00
Stephen Kelly 37b88d348a cmAlgorithms: Add cmWrap.
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.
2015-02-20 21:35:58 +01:00
Stephen Kelly ac26d4b343 Split cmAlgorithms into a separate header file. 2015-02-10 22:14:18 +01:00
Brad King e2619c13f7 Merge topic 'use-algorithms'
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.
...
2015-02-10 09:37:57 -05:00
Brad King c548ddc172 Merge topic 'makefile-progress-improvements'
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
2015-02-10 09:37:55 -05:00
Brad King c6ada8275b Makefile: Print all color escape sequences before newline
Ensure that the escape sequences do not leak across lines.
2015-02-06 16:41:51 -05:00
Brad King 0f870234fe Merge branch 'backport-no-global-setlocale' into no-global-setlocale
Resolve conflict in Source/CMakeLists.txt by taking both changes.
2015-02-06 13:35:21 -05:00
Brad King cd408d93fd Add setlocale() calls around use of libarchive APIs (#14934, #15377)
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>
2015-02-06 13:32:57 -05:00
Stephen Kelly d8639733a4 cmSystemTools: Remove unnecessary comparison.
We already know the string is uppercase.
2015-02-06 19:04:10 +01:00
Stephen Kelly 803317aab6 cmSystemTools: Early return if size makes later comparison false. 2015-02-06 19:04:10 +01:00
Brad King 69ac6d2755 bootstrap: Enable color Makefile output
Build the needed infrastructure during bootstrap in order to allow
"cmake -E cmake_echo_color" to be used unconditionally during
generation.
2015-02-05 16:44:56 -05:00
Stephen Kelly 421eadb45b Remove use of cmsys_stl.
It is not needed.
2015-02-05 20:44:25 +01:00
Brad King 3a60c899fc cmake: Teach "-E tar" command a "--mtime=" option
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>
2015-01-19 14:16:19 -05:00
Stephen Kelly 930bd47816 Replace 'foo.size() == 0' pattern with foo.empty(). 2015-01-18 14:25:24 +01:00
Brad King dd6c596c12 Merge topic 'join-algorithm'
55a73e6b Use the cmJoin algorithm where possible.
8dc8d756 cmStandardIncludes: Add a join algorithm for string containers.
b5813cee cmInstallCommand: Remove unused variable.
2015-01-12 09:41:02 -05:00
Brad King d9a6ea4599 Merge topic 'add-xz-support'
4035ef78 cmake -E tar: error out on multiple compression formats
d811d238 cmSystemTools: use an enumeration for compression formats
df16dcfb cmake -E tar: add support for .xz files with 'J'
b0a5d393 cmake -E tar: clean up flag documentation
2015-01-12 09:39:40 -05:00
Ben Boeckel d811d238ab cmSystemTools: use an enumeration for compression formats
Juggling 3 booleans was unwieldy.
2015-01-12 09:36:25 -05:00
Brad King b5a467262b Merge topic 'drop-ancient-workarounds'
0f7bdd61 Remove VS 6 special case.
5e92c826 Remove some obsolete stuff.
15e42bb2 cmStandardIncludes: Remove obsolete cmOStringStream.
931e055d Port all cmOStringStream to std::ostringstream.
f194a009 Remove unused cmIStringStream class.
3ec1bb15 cmStandardIncludes: Remove std namespace hack.
bb3bce70 cmStandardIncludes: Remove ANSI_FOR_SCOPE hack.
28fa4923 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler.
837a8a63 cmStandardIncludes: Drop Comeau-related workaround.
4030ddfd Remove Borland-related undef.
17d6a6fd cmStandardIncludes: Remove comment about Borland.
26fb5011 Drop SGI as a CMake host compiler.
2015-01-12 08:57:39 -05:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Stephen Kelly 238dd2fbab Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector.

A follow up change can use insert for inserting into a set.
2015-01-11 17:00:55 +01:00
Ben Boeckel df16dcfb44 cmake -E tar: add support for .xz files with 'J' 2015-01-09 10:35:01 -05:00
Stephen Kelly 55a73e6b1f Use the cmJoin algorithm where possible. 2015-01-08 22:28:18 +01:00
Stephen Kelly 26fb50114f Drop SGI as a CMake host compiler.
It has not been tested since commit v3.1.0-rc1~584^2 (Utilities/Release: Drop
IRIX binary generation on ferrari, 2014-04-30).
2015-01-08 22:10:14 +01:00
Clinton Stimpson c294a115f2 Mach-O: Use Mach-O parser to extract install names instead of otool.
This has much better performance than calling "otool" or "xcrun -r otool"
to extract install names for rpath support.

Fixes bug #15178.
2014-12-22 11:33:00 -07:00
Ruslan Baratov 97841dad2b file: Use 'long' to represent the parsed LOCK TIMEOUT value
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.
2014-12-05 12:59:37 -05:00
Ruslan Baratov 05d6531c7a cmSystemTools: Add StringToInt helper
Convert a string to a signed integer and reject any extra input.

Co-Author: Rolf Eike Beer <eike@sf-mail.de>
2014-12-03 09:47:26 -05:00
Brad King c7b9fad117 Merge topic 'remove-ancient-msvc-workarounds'
12cb0b86 Help: Update developer manual with some C++ features now permitted.
ba74465f cmGeneratorTarget: Remove MSVC7 workaround
41363c0c VisualStudio: Remove MSVC6 compatibility macro.
4efcfe52 cmSystemTools: Remove MSVC6 compatibility define.
5f4695cd cmStandardIncludes: Remove MSVC6 condition for cmArrayBegin macro.
7a064337 cmFindCommon: Remove MSVC6 workaround for nested struct private access.
fdb73547 cmTarget: Remove std::min and std::max MSVC6 compatibility code.
2014-11-25 10:28:57 -05:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Stephen Kelly 4efcfe52f4 cmSystemTools: Remove MSVC6 compatibility define. 2014-11-20 22:24:27 +01:00