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.
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.
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>
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.
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.
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.
Windows and Apple machines have predominantly used case-insensitive
filesystems so our file(INSTALL) command uses case-insensitive pattern
matching. It is implemented by converting the pattern and file path to
lower case before matching. The FILES_MATCHING option is implemented by
excluding a path that does not match any pattern unless it is a
directory that must be searched recursively. However, the test that an
excluded path is a directory is executed on the lower-case path and
therefore fails on mixed-case input paths on case-sensitive filesystems.
Fix the file(INSTALL) implementation to use the lower-case path only for
pattern matching and preserve the original path for tests against the
real filesystem.
It seems that file.seekg(0) will, in some circumstances, cause the next
file.getline() to omit the first character it reads. Workaround the
bug by seeking from ios::beg explicitly.
The purpose of the TargetType enumeration was overloaded for install
type because install rules were once recorded as targets. Factor the
install types out into their own enumeration.
If a http server responds with a result code greater than 400 then the
data returned from the download probably do not match that expected.
Teach file(DOWNLOAD) to fail with an error in this case instead of
silently pretending that the download worked. The file(UPLOAD) command
already does this.
The SetError method automatically starts the message with the name of
the command. Fix up calls to it so that we get "file DOWNLOAD..."
instead of "file FILE(DOWNLOAD ...". Also reduce length of long lines
containing these calls.
Commit 0fafdb7e (Do not copy permissions of files when making the copy
in an install rule, 2008-12-18) added special behavior to KWSys file
copy methods for this special case. Use a local solution to avoid use
of the special behavior so it can be removed later.
Commit 8d0161c8 (Trust umask for file permissions, 2010-01-12) taught
these commands to set permissions to 0666 explicitly. The intention was
to let the open() call inside ofstream handle permsisions so that umask
would be honored. Now we set permissions only when we need to preserve
those on an existing file. New files will be created with umask-based
permissions.
Improve FILE(DOWNLOAD ...):
- Add percent complete progress output to the FILE DOWNLOAD
command. This progress output is off by default to
preserve existing behavior. To turn it on, pass
SHOW_PROGRESS as an argument.
- Add EXPECTED_MD5 argument. Verify that the downloaded
file has the expected md5 sum after download is complete.
- Add documentation for SHOW_PROGRESS and EXPECTED_MD5.
When the destination file exists already and has the
expected md5 sum, then do not bother re-downloading
the file. ("Short circuit" return.)
Also, add a test that checks for the status output
indicating that the short circuit behavior is actually
occurring. Use a binary file for the test so that the
md5 sum is guaranteed to be the same on all platforms
regardless of "shifting text file line ending" issues.
Improve ExternalProject:
- Add argument URL_MD5.
- Add verify step that compares md5 sum of .tar.gz file
before extracting it.
- Add md5 check to download step, too, to prevent
unnecessary downloads.
- Emit a warning message when a file is not verified.
Indicate that the file may be corrupt or that no
checksum was specified.
Commit "Support more special characters in file(STRINGS)" (2009-10-06)
attempted to support parsing strings from binaries produced by the
Portland Group Fortran compiler. The compiler seems to put an extra
byte just at the end of its string literals. Previously we dealt with
this by explicitly enumerating bytes known to occur, but it seems that
many such possibilities exist. Now we support extraction of strings
that end in any non-ASCII character.
The commit "Support more special characters in file(STRINGS)" added code
using a 'char' literal as an array index. Some compilers warn about
this because char might be a signed type, leading to negative indices.
We replace the literal with an integer to avoid the warning.
The commits "Teach Fortran compiler identification about the Portland
Group compiler" and "Fix previous change to file(STRINGS) command"
taught file(STRINGS) to recognize the form-feed '\f' character as part
of string literals. The Portland Group Fortran compiler also puts 0x14
bytes at the end of string literals in some cases. We generalize the
previous solution and add the new character in this commit.
This converts the CMake license to a pure 3-clause OSI-approved BSD
License. We drop the previous license clause requiring modified
versions to be plainly marked. We also update the CMake copyright to
cover the full development time range.
The GNU compiler warns about possible operator precedence mistakes and
asks for explicit parentheses (-Wparentheses). We add the parentheses
to silence the warning. This also fixes one real logic error in the
find_package() implementation by correcting expression evaluation order.
It seems that
while(i=file.get(), file)
iterates one character too much on HP-UX, let's see whether
while(file.get(c))
works, at least this is given as example on http://h30097.www3.hp.com/cplus/ifstream_3c__std.htm
Alex
Nested classes have no special access to other members of their
enclosing class. In cmFileCopier the nested class MatchRule must use
MatchProperties, so we grant friendship to it.
This gives cmFileCopier a virtual destructor since it has virtual
methods. While we never actually delete through a base pointer (or
dynamically at all), the compiler doesn't know and warns anyway.
The file(INSTALL) command has long been undocumented and used only to
implement install() scripts. We now document it and provide a similar
file(COPY) signature which is useful in general-purpose scripts. It
provides the capabilities of install(DIRECTORY) and install(FILES) but
operates immediately instead of contributing to install scripts.
This teaches the undocumented file(INSTALL) command to deal with
relative paths. Relative input file paths are evaluated with respect to
the current source directory. Relative output file paths are evaluated
with respect to the current binary directory.
While this command is currently used only in cmake_install.cmake scripts
(in -P script mode), this cleans up its interface in preparation for a
documented signature.
The undocumented file(INSTALL) is implemented by a cmFileInstaller class
inside cmFileCommand. This refactors the class to split out code not
specific to installation into a cmFileCopier base class.
This creates a single cmFileInstaller method to dispatch installation of
symlinks, directories, and files. The change removes duplicate tests of
input file type and makes the decision more consistent.
While copying a directory the destination must have owner rwx
permissions. This corrects our check, this time with correct operator
precedence using parenthesis.
This teaches the command to interpret relative paths with respect to the
location of the invoking CMakeLists.txt file. The convention is already
used by most commands and won't change the behavior in script mode.
When CMake 2.4 generates the build tree for CMake itself it asks the
built CMake to install itself using the rules that 2.4 generated. Since
the install rules use undocumented commands that are not compatible from
2.4 to 2.6 we need a special case to avoid failure. This sets a special
indicator variable in the install rules that enables a compatibility
hack to support the old install rule format.
The internal file(INSTALL) command argument parsing used several
booleans with at most one set to true at a time to track argument
parsing state. This refactors it to use one enumeration.
- CMake 1.8 and below did not do the check but could get in
infinite loops due to the local generate step.
- CMake 2.0 added the check but failed to perform it in directories
with no targets (see bug #678).
- CMake 2.2 removed the local generate which fixed the problem but
did not remove the check.
- Between CMake 2.4 and 2.6.0rc6 the check was fixed to work even
when no targets appear in a directory (see bug #6923).
- Bottom line: the check is no longer needed.
- If new RPATH is empty then remove the entry completely
- Preserve file modification time so installation is not repeated
- If installed file already exists remove it if its RPATH
does not match that expected
- Move computation of extended build-tree rpath
to cmComputeLinkInformation
- Only enable the extended build-tree rpath if
the target will be installed
- Generalize the interface of file(CHRPATH)
- When changing the rpath on installation only
replace the part generated by CMake because
the native tools (ex SunCC on Linux) might have
added their own part to the rpath
- Add cmSystemTools::ChangeRPath method
- Add undocumented file(CHRPATH) command
- When installing use file(CHRPATH) to change the rpath
instead of relinking
- Remove CMAKE_CHRPATH lookup from CMakeFindBinUtils
- Remove CMAKE_USE_CHRPATH option since this should
always work
with cmake cvs without this patch an invalid cmake_install.cmake script was
generated in this case, it failed with an error if no files were given. So
just do nothing if no files are listed to make it compatible.
http://lists.kde.org/?l=kde-commits&m=119965185114478&w=2
Alex
offset can be specified where the reading starts, and using HEX the data can
be converted into a hex string, so binary data can be compared with text
functions
-add docs for LIMIT, OFFSET and HEX
Alex
conversion of hex and srec files to binary.
Without this automatic conversion, everywhere where a compiled file is parsed for strings the
a file(HEX2BIN somefile binfile) command has to be added otherwise it will
not work for these compilers. I tried this with DetermineCompiler and
CheckTypeSize and nobody will do this except the users who work with such
compilers. For them it will break if they don't add this conversion command
in all these places.
If FILE(STRINGS) is used with a text file, it
will in most cases still work as expected, since it will only convert hex
and srec files. If a user actually wants to get text out of hex files, he
knows what he's doing and will see the hint in the documentation.
Anyway, it should work without having to create a temporary file, will work
on this later.
Alex