Commit Graph

220 Commits

Author SHA1 Message Date
Bill Hoffman a4a1b729c6 Fix warnings from clang scanbuild. 2015-03-25 12:38:37 -04:00
Domen Vrankar a2c068a7ce file: Teach GLOB to list directories optionally
GLOB lists directories by default and GLOB_RECURSE does not.
LIST_DIRECTORIES enables user to control the behavior explicitly for
consistently for both GLOB and GLOB_RECURSE.
2015-03-20 09:45:25 -04:00
Stephen Kelly 7916d7bac6 Include cmAlgorithms where it is used. 2015-03-11 00:17:29 +01:00
Brad King 38f1f4e7f3 Merge topic 'install-manifest-optimize'
c4814174 install: Write the entire installation manifest at once
2015-02-27 10:34:35 -05:00
Robert Goulet c48141744e install: Write the entire installation manifest at once
Avoid a separate open/close for each file installed.  Use a single
file(WRITE) instead of a loop with file(APPEND).
2015-02-26 15:04:07 -05:00
Stephen Kelly 27c6f017a1 Use cmJoin to accumulate string ranges.
Avoid using the std::accumulate algorithm which is designed for
numeric types, not complex types.  It introduces unneccessary
copies.

Initialize variables where they are populated.
2015-02-11 22:57:55 +01:00
Stephen Kelly 421eadb45b Remove use of cmsys_stl.
It is not needed.
2015-02-05 20:44:25 +01:00
Justin Borodinsky 1f77a7001b file: Teach STRINGS to support UTF-16 and UTF-32 encodings 2015-01-27 11:30:26 -05:00
Brad King 0abd3e538e cmake: Use a default CA path when not using system curl
When using system curl, we trust it to be configured with desired CA
certs.  When using our own build of curl, we use os-configured CA certs
on Windows and OS X.  On other systems, try to achieve this by searching
for common CA cert locations.  According to a brief investigation, the
curl packages on popular Linux distros are currently configured as:

* Arch: /etc/ssl/certs/ca-certificates.crt
* Debian with OpenSSL: /etc/ssl/certs
* Debian with GNU TLS: /etc/ssl/certs/ca-certificates.crt
* Debian with NSS: /etc/ssl/certs/ca-certificates.crt
* Fedora: /etc/pki/tls/certs/ca-bundle.crt
* Gentoo with OpenSSL: /etc/ssl/certs
* Gentoo without OpenSSL: /etc/ssl/certs/ca-certificates.crt

Teach CMake and CTest to look for these paths and use them as a CA path
or bundle when no other os-configured or user-specified CAs are
available.
2015-01-23 08:57:32 -05:00
Stephen Kelly fd0c036c0c Replace 'foo.length() >= 1' pattern with !foo.empty() 2015-01-18 14:25:25 +01:00
Stephen Kelly fd7b371293 Replace foo.size() pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly 930bd47816 Replace 'foo.size() == 0' pattern with foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly d92887efab Replace 'foo.size() > 0' pattern with !foo.empty(). 2015-01-18 14:25:24 +01: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
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 e6db4c5a4e file: Add LOCK subcommand to do file and directory locking
Provide options to fail without blocking or to block up to a timeout.
Provide options to specify the scope containing the lock so it can be
released automatically at the end of a function, file, or process.

Extend the RunCMake.file test with cases covering the file(LOCK) command
usage and error cases.
2014-12-03 09:47:44 -05:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Clinton Stimpson e63dcb1378 Encoding: Use encoding libcurl expects with file: urls.
For unescaped file: URLs on Windows, libcurl expects
the ANSI code page.

This fixes the CMake.FileUpload test when CMake is configured
to use UTF-8 internally with a non-ascii build directory name.
2014-11-05 07:20:21 -07:00
Brad King 210230e216 Merge topic 'remove-borland-build'
2db55ffa Remove borland workarounds.
2014-10-21 15:08:03 -04:00
Stephen Kelly 2db55ffa56 Remove borland workarounds.
CMake 3.0 is the last release to require to be able to build with
Borland.
2014-10-15 23:16:44 +02:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Clinton Stimpson 5b30ec28f9 file: Add ENCODING option to file(STRINGS) command (#10519)
Support extraction of UTF-8 strings.
2014-08-06 09:23:47 -04:00
Clinton Stimpson ffa373e711 file: Refactor internal implementation of file(STRINGS)
Make room for encoding support.
2014-08-06 09:23:15 -04:00
Clinton Stimpson 9571214e55 Encoding: Replace some system calls with kwsys calls which handle unicode. 2014-07-01 06:38:35 -06:00
Brad King abebcd235c file(INSTALL): Add undocumented options to control output verbosity
Create options "MESSAGE_ALWAYS", "MESSAGE_LAZY", and "MESSAGE_NEVER" to
specify whether to print the "Installing" and "Up-to-date" messages.
Extend the RunCMake.file test with cases covering these options.
2014-06-24 13:11:45 -04:00
Brad King 464567a577 file(INSTALL): Report existing DIRECTORY as Up-to-date
Teach cmFileCopier::InstallDirectory to detect whether the destination
directory exists.  If so, report it as "Up-to-date" instead of
"Installing".  This resolves message asymmetry with file installations.

Extend the RunCMake.file and RunCMake.install tests to check the
installation output on both the first and second run.

Suggested-by: J Decker <d3ck0r@gmail.com>
2014-06-24 12:52:11 -04:00
Brad King f701b0b7f7 file(INSTALL): Do not pre-create DESTINATION for DIRECTORY
When installing a DIRECTORY, do not pre-create the DESTINATION.  The
cmFileCopier::InstallDirectory method will create the directory anyway.
Give it a chance to detect whether the directory already exists or not.
2014-06-24 12:52:11 -04:00
Ben Boeckel a08292059e genex: remove the need for backtraces
Rather than making dummy backtraces and passing them around, just make
backtraces optional.
2014-06-05 12:44:18 -04:00
Ben Boeckel d46c650d67 cmMakefile: return a backtrace
This allows backtraces to be fully controlled by the makefile rather
than externally (and makes changing how they are manipulated easier).
2014-06-05 12:44:04 -04:00
Brad King 2c448dbfe7 file: Report system error on failure to open file 2014-05-20 11:07:51 -04:00
Brad King 413282c0cf file: Avoid runaway DOWNLOAD/UPLOAD progress reports (#14807)
Curl makes progress callbacks frequently but we round to the nearest
percent and report only when that changes so that we make at most 101
progress reports.  However, when unexpected data beyond the total are
transferred the progress can get beyond 100% and lead to unlimited
reports.  Avoid this case by capping the reported progress to 100%.
2014-03-17 11:05:34 -04:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Matt McCormick a432b93b79 file DOWNLOAD: Display the curl result status when a hash mismatch occurs. 2014-01-15 20:08:44 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Sean McBride 1399825cf9 Remove some uses of obsolete 'register' storage specifier
Remove the keyword from all Source/* files outside of KWSys.
2013-06-28 16:37:49 -04:00
Brad King be85fa4a89 Merge topic 'genex-generate-file'
b983a58 file: Add GENERATE command to produce files at generate time
2013-05-28 10:42:18 -04:00
Stephen Kelly b983a58bdf file: Add GENERATE command to produce files at generate time
The idea is to write to a temp file which contains generator
expressions, and at generate time, evaluate the generator expressions,
and write the result to a file.

Because executables on Windows are limited in the length of command line
it is possible to use, it is common to write command line arguments to a
file instead and specify the file as a source of arguments.

This new FILE(GENERATE) subcommand allows the use of generator
expressions to create such files so that they can be used with
add_custom_command for example.
2013-05-24 09:02:45 -04:00
Andreas Mohr ddac8d3d2d Fix spelling and typos (affecting binary data / module messages) 2013-05-07 08:39:19 -04:00
Brad King f123367254 file: Do not remove symlinked directories recursively (#10538)
If a symlink points at a directory the symlink should be removed but not
the content of the directory.
2013-02-13 10:00:50 -05:00
David Cole 354ecc1e1f CMake: Fix dashboard warnings
...in the new file and string TIMESTAMP sub-commands
2012-12-05 13:19:09 -05:00
Nils Gladitz 711e2b3b5c CMake: Add TIMESTAMP subcommand to string and file commands 2012-12-05 10:39:10 -05:00
Amine Chadly c2a6cb64af file: remove dead code
The file command requires at least two arguments, so guarding the GLOB and
MAKE_DIRECTORY command is not necessary. Changed it for an assert to keep the
protection.
2012-11-02 17:10:06 +01:00
David Cole 998a17d098 Merge topic 'file-DOWNLOAD-EXPECTED_HASH'
95a0011 file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value
2012-09-25 15:17:01 -04:00
Brad King 03077c9cbc Merge topic 'file-DOWNLOAD-user-agent'
14aff4d file(DOWNLOAD): Add HTTP User-Agent string
2012-09-19 13:58:01 -04:00
Brad King 95a0011604 file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value
Make the EXPECTED_HASH option take only a single value instead of two to
avoid handling sub-keyword arguments.  This is also consistent with
URL_HASH in ExternalProject.
2012-09-19 11:31:36 -04:00
Brad King 14aff4daf4 file(DOWNLOAD): Add HTTP User-Agent string
Some servers require a User-Agent string.  The curl command-line tool
just sends "curl/$curlver", so do the same.

Suggested-by: Fredrik Ehnbom <fehnbom@nvidia.com>
2012-09-18 14:53:07 -04:00
Brad King 7369a8faee file(DOWNLOAD): Make TLS options behave as documented
The logic added in commit e1c89f08 (file(DOWNLOAD): Add options for SSL,
2012-08-21) did not actually provide the documented behavior.  Simplify
the implementation to read the variable values first and then replace
them with the explicit argument values if encountered.  Always set the
curl option CURLOPT_SSL_VERIFYPEER to either on or off explicitly
instead of depending on the curl default behavior.
2012-09-17 09:03:45 -04:00
Brad King 131d91a1f9 Rename SSL terminology to TLS
TLS has superseded SSL so rename the recently added file(DOWNLOAD) and
ExternalProject options using the newer terminology.  Drop "CURLOPT"
from names because curl is an implementation detail.
2012-09-14 15:40:09 -04:00
Bill Hoffman e1c89f08bb file(DOWNLOAD): Add options for SSL
Add the ability to request that downloads disable or enable Certificate
Authority checking with https ssl downloads.  When the option to verify
the servers CA is disabled, one may verify download contents with SHA
hashes.
2012-09-11 15:34:54 -04:00
Bill Hoffman 34567dfc0d file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH
Add support for SHA algorithms.
2012-09-11 08:58:29 -04:00