Commit Graph

522 Commits

Author SHA1 Message Date
Stephen Kelly 48bb48e114 De-duplicate version comparison code.
Extend the VersionCompare in cmSystemTools to handle 8 components,
and port the if command to use that.
2013-06-12 14:09:36 +02:00
Clinton Stimpson ff01f8b600 OS X: Improvements for getting install name of dylib.
In the case of a multi-arch dylib where none of the architectures
is the host architecture, otool -D returned multiple install names.
2013-06-05 21:31:11 -06:00
Clinton Stimpson 94e7fef226 OS X: Add RPATH support for Mac.
RPATH support is activated on targets that have the MACOSX_RPATH
property turned on.
For install time, it is also useful to set INSTALL_RPATH to help
find dependent libraries with an @rpath in their install name.

Also adding detection of rpath conflicts when using frameworks.
2013-06-03 09:42:05 -04:00
Petr Kmoch 674f918a1a cmSystemTools: Generalize TrimWhitespace to all whitespace
Modify cmSystemTools::TrimWhitespace() to remove all leading and
trailing whitespace, not just spaces.
2013-03-27 08:46:55 -04:00
Brad King 59b568e5e8 Fix cmSystemTools::RenameFile race on Windows
Since commit d46d8df0 (Re-implemented cmGeneratedFileStream to look like a
real stream and replace the destination file atomically, 2004-11-03) our
RenameFile implementation tries to deal with MoveFile not replacing
read-only files.  In order to avoid the Get/SetFileAttributes pair we used
stat to test for existence of the destination file.  This has a race in
which the destination could be created between the test for existence and
the MoveFile call.

Remove the stat call and use GetFileAttributes to detect whether the file
exists.  This shortens the race but does not eliminate it.  Use a loop to
try multiple times in case we lose the race.  While at it, drop Win9x
support and always use MoveFileEx.
2013-02-04 15:15:21 -05:00
Brad King 4046fc0104 Merge topic 'use-cmsys-auto_ptr'
ddc0520 Always use the auto_ptr from cmsys.
2012-11-27 13:34:25 -05:00
David Cole 37c34d7d7b CMake: Fix infinite loop untarring corrupt tar file
Suggested-by: Robert Maynard <robert.maynard@kitware.com>
2012-11-26 11:54:38 -05:00
Stephen Kelly ddc052052b Always use the auto_ptr from cmsys.
This is for consistency throughout cmake. The cmsys version exists
becaues uses of auto_ptr types as return types does not work with
some implementations in ancient compilers.
2012-11-21 00:56:36 +01:00
David Cole c75f404065 Merge topic 'kwsys-environ-cleanup'
e48796b KWSys: Fix SystemTools environment memory handling (#13156)
b10c5cb CTest: Simplify environment save/restore
2012-05-01 14:09:12 -04:00
David Cole fd1788294d Merge topic 'mac_environ'
a90d478 [OSX] Fixed undefined symbol when linking CMakeLib into shared library
2012-04-25 14:00:22 -04:00
Brad King b10c5cbb87 CTest: Simplify environment save/restore
Replace use of AppendEnv/RestoreEnv pairs with instances of
SaveRestoreEnvironment.  Simplify the signature of AppendEnv and use it
in place of similar loops elsewhere.  Move the RestoreEnv implementation
inside the SaveRestoreEnvironment destructor which is the only place
left that calls it.
2012-04-24 16:56:14 -04:00
Konstantin Tokarev a90d47890f [OSX] Fixed undefined symbol when linking CMakeLib into shared library 2012-03-03 19:33:35 +04:00
David Cole bada88e8e4 Merge branch 'target-include-directories' into ninja-generator 2012-02-22 16:21:48 -05:00
David Cole e65f39a59e Merge topic 'interrupt-bug-12649'
131eed6 cmake-gui: Improve interrupt granularity to fix bug 12649.
2012-02-14 16:14:35 -05:00
Peter Collingbourne 2cd36550b0 Add cmSystemTools::TrimWhitespace function 2012-02-02 23:04:38 +00:00
Clinton Stimpson 131eed6607 cmake-gui: Improve interrupt granularity to fix bug 12649.
Instead of enabling interrupt only when a progress or message callback is called, add a new callback specifically for
interrupt.  This new callback is called from GetFatalErrorOccured() so cmake-gui can immediately report interrupt status
instead of calling queuing a call to cmSystemTools::SetFatalErrorOccured() and waiting for the progress or message
callback to be called to process that queued call.
2012-01-02 11:07:43 -07:00
Brad King ffdb37a4f7 Handle libarchive API change in archive_read_data_block
The offset argument type depends on the libarchive version.
2011-12-22 10:52:03 -05:00
Brad King ed7cef5634 Factor Compute(File|String)MD5 into cmCryptoHash helper
Define an abstract API around the backend hash algorithm.  Expose
ifstream errors to HashFile callers.  Always try opening the file.
Succeed only if the end of file is reached without error.
2011-11-16 10:14:53 -05:00
Brad King a343bc1c76 RunSingleCommand: Avoid assignment in condition
Several compilers warn about this case even when an extra layer of
parenthesis surrounds the assignment.  Make the condition explicit.
2011-07-28 10:43:11 -04:00
Johan Björk 642f10066a RunSingleCommand: Add a OUTPUT_NORMAL flag.
OUTPUT_NORMAL does no processing of the output streams, it just passes
them through the same streams as they were received on.
2011-07-28 10:43:09 -04:00
Johan Björk 856a9e499f RunSingleCommand: Replace verbose boolean with enum
No behaviour change, this prepares for adding a flag to skip the merging
of output streams.
2011-07-28 10:42:03 -04:00
Brad King 4096066723 RunSingleCommand: Fix indentation 2011-07-28 10:28:52 -04:00
Brad King acd2f84cc0 cmSystemTools: Remove trailing whitespace 2011-07-28 10:23:13 -04:00
Brad King 98dc13e513 Merge topic 'xcode-source_groups-folders-issue-10039'
f09ba0f Fix style errors added by parent and grandparent
eeeeca1 XCode: Support target folders on XCode.
59ed84e Xcode: Support multiple level nesting of XCode folders (#10039)
d0a403f CMake: Move tokenize to cmSystemTools
2011-06-08 15:44:44 -04:00
Johan Björk d0a403fd99 CMake: Move tokenize to cmSystemTools 2011-06-07 10:18:54 -04:00
Brad King 3232136fc8 Merge topic 'dont-compress-memcheck-output'
0e591ed Fix type conversion warning
9c3a0b9 We will actually compress memcheck output if the server supports it.
8024c53 Dynamic analysis test output should not be compressed.
2011-06-02 11:29:09 -04:00
Zach Mullen 9c3a0b9f14 We will actually compress memcheck output if the server supports it.
This change won't be functional until the next release of CDash due to the
version comparison.
2011-05-26 14:50:07 -04:00
Brad King e51bbc14f6 Merge topic 'output-compile-lines'
cdc2b41 Fix CompileCommandOutput test build on Windows
7039d1f Fix CompileCommandOutput test for Make tools not supporting spaces
4268e3d run_compile_commands: Cast istream::get() result to char
c45c60b run_compile_commands: Avoid extra stl vector conversion
7c5be51 run_compile_commands: Avoid shadow in std::map<>::at workaround
169bb05 Provide std::map<>::at for use in run_compile_commands
4e2185c Make std::map usage more portable in language=>flags/defines maps
a7e7a04 Fix run_compile_commands build on Apple GCC 3.3
c9174c0 Fix signed/unsigned comparison in EscapeJSON
8346a28 Only offer the compile command output feature on unix systems
0e6b05f Adds a test for the compile command line output.
5674844 make compile command output optional
fe07b05 implement cxx command output
65c0c24 cache flags and defines
3f064ef refactor flags and defines
2011-05-24 14:48:14 -04:00
Brad King 3d92c8c827 Explicitly cast time value in cmSystemTools::RandomSeed
Use static_cast to avoid warnings like

 conversion to ‘unsigned int’ from ‘__time_t’ may alter its value
 conversion to ‘unsigned int’ from ‘__suseconds_t’ may alter its value

We do not care if the value is truncated because we are looking for just
32 bits anyway.
2011-05-19 07:56:04 -04:00
Brad King eb6f461fc1 VS 6: Define _WIN32_WINNT to load wincrypt.h correctly 2011-05-18 10:09:23 -04:00
Brad King c45c60b24f run_compile_commands: Avoid extra stl vector conversion
The Sun compiler does not provide the proper vector constructor to
initialize it from an iterator pair of a non-matching type.  Extend the
ParseUnixCommandLine API to provide a vector of the proper type so no
conversion is needed.
2011-05-18 09:44:28 -04:00
Brad King e1b0a11dd4 Improve string(RANDOM) default seed
The naive time(0) seed is unique only within one second.  Instead try to
read a real source of entropy and otherwise fall back to a combination
of the process id and high-resolution time.
2011-05-17 10:07:26 -04:00
Brad King f306a357b2 Merge topic 'style-line-length'
9d21281 Fix line-too-long style errors
86025d3 file(DOWNLOAD): Fix error message formatting
2010-09-14 13:19:53 -04:00
Brad King 9d21281b7d Fix line-too-long style errors 2010-09-10 14:42:09 -04:00
David Cole 666f328858 Preserve timestamps on files on tar extract.
Conversion to libarchive changed the behavior of
cmake -E tar xzf. This commit fixes that oversight.
2010-09-09 12:57:14 -04:00
Eric NOULARD 40dc97dc73 CPack Backward-compatibly enforce DESTDIR for DEB and RPM 2010-08-23 16:14:40 +02:00
Brad King cb9ea2647f Remove cmSystemTools::EscapeSpaces method
The last remaining call to this method exists only for compatibility.
Remove the method and put its implementation inline in place of the last
call.
2010-08-18 10:26:05 -04:00
Eric NOULARD b50c15915a Add ZIP archive format and LZMA compress support to libarchive-wrapper
This will be needed to use cmArchiveWrire in cmCPackArchiveGenerator
with the same feature set as before. Note that adding zip
support to libarchive-wrapper would also makes it easy to add
a new -E zip command to cmake commands.
2010-08-13 17:49:47 +02:00
Brad King 1b5b2ed3b2 Include entries for directories in tarballs (#11020)
Use libarchive through class cmArchiveWrite to implement the method
cmSystemTools::CreateTar.  The class includes entries for directories by
automatically traversing the tree on disk.
2010-08-06 11:38:14 -04:00
Brad King 3296e6ad90 Include headers from chosen libarchive (#10923)
When CMAKE_USE_SYSTEM_LIBARCHIVE is on we must include the system
libarchive headers to match the library that will be linked.
2010-08-05 17:06:10 -04:00
Brad King ff1f8d0b53 Fix or cast more integer conversions in cmake
These were revealed by GCC's -Wconversion option.  Fix types where it is
easy to do so.  Cast in cases we know the integer will not be truncated.
2010-06-29 09:52:12 -04:00
Brad King 6fc4cd8680 Fix or cast integer conversions in cmake
These were revealed by GCC's -Wconversion option.  Fix types where it is
easy to do so.  Cast in cases we know the integer will not be truncated.
2010-06-25 09:05:15 -04:00
Brad King fdb5f78705 CPack: Try harder to remove temporary dir (#10793)
Windows filesystems sometimes lock files temporarily.  Try removing the
CPack temp install folder multiple times before giving up.
2010-06-04 14:32:08 -04:00
Brad King ea62d6973b Do not list file names during 'cmake -E tar xz'
Since commit "Switch to using libarchive from libtar" (2009-10-30) the
the implementation of "tar xz" has printed all paths from the tarball as
a single line with no separator.  This fixes the logic to extract
silently as expected.
2010-05-05 14:44:36 -04:00
David Cole 10a4abddfd Add missing archive_read_finish calls to fix some of the presently reported valgrind memory leaks. 2009-12-28 13:15:19 -05:00
David Cole 4d3a387ac6 Preserve environment variables across calls to cmCTestScriptHandler::RunConfigurationScript. This will help prevent problems like we are currently experiencing (regarding CMake continuous dashboards only running once each day because the HOME environment variable is modified indirectly by a command in a called script, but affects the environment in the calling script). 2009-12-23 14:34:46 -05:00
Zach Mullen 3cb2a0ffa6 Move cURL dependent code out of CMakeLib to fix complex tests. 2009-12-22 14:37:06 -05:00
Zach Mullen 766ef1d011 Fix broken bootstrap test 2009-12-22 09:03:18 -05:00
Zach Mullen 5aad7bf2d4 Make new web api safe for bootstrap build. 2009-12-21 16:42:32 -05:00
Zach Mullen 3ff0b94055 Added functionality to allow CTest to easily access web APIs. This will be used for better communication with CDash. 2009-12-21 15:19:57 -05:00
Zach Mullen 7af553188e Added support for CTest awareness of the CDash version. This will help forward compatibility for both tools. Note that this changeset effectively makes the default to disable output compression. Now, to enable output compression, the CDASH_CTEST_VERSION must be explicity set to >= 1.6. Automated detection of the CDash version is the next step. 2009-12-21 12:27:04 -05:00
Bill Hoffman 22fb266d06 use different tar format to handle longer file names 2009-11-14 08:48:32 -05:00
Bill Hoffman 28664b96f7 Show the current file when there is a tar error 2009-11-13 16:07:42 -05:00
Bill Hoffman a875845be9 fix warning for borland 2009-11-13 07:39:10 -05:00
Bill Hoffman dc5d1edcfd Fix missing return value. 2009-11-12 10:52:32 -05:00
Bill Hoffman 79b8d61ae9 Fix for working with symlinks in tar files 2009-11-08 19:59:01 -05:00
Bill Hoffman f5fe20dc12 Fix some warnings 2009-11-08 10:34:12 -05:00
Bill Hoffman 7961c8685b go back to running stat and put size check in 2009-11-08 10:19:36 -05:00
Bill Hoffman 34ce92f151 Remove check for now so test passes on linux 2009-11-07 21:08:38 -05:00
Bill Hoffman 03cebb9a7f create a better error message 2009-11-07 20:45:34 -05:00
Bill Hoffman 3d1afdee4a add much better error checking on libarchive calls. 2009-11-07 19:35:35 -05:00
Zach Mullen a9a4814971 Fix compiler error in cmSystemTools.cxx 2009-11-05 16:14:46 -05:00
Bill Hoffman dd09d88065 Add JOM support and clean up some of the tar -E stuff 2009-11-05 15:00:15 -05:00
Zach Mullen 9f105a3f6d Fix style warning in cmsystemtools, cosmetic change to ctest code 2009-11-05 11:37:47 -05:00
Zach Mullen cdbbe00a8b Fix unused param warning resulting from libarchive API change. 2009-11-04 11:36:23 -05:00
Bill Hoffman 5f41fe03ca Fix warnings for unused variables 2009-11-03 16:50:49 -05:00
Bill Hoffman fb51d98562 Switch to using libarchive from libtar for cpack and cmake -E tar
This allows for a built in bzip and zip capability, so external tools
will not be needed for these packagers.  The cmake -E tar xf should be
able to handle all compression types now as well.
2009-10-30 13:10:56 -04:00
David Cole 43d07f6620 Fix more mismatched new[] / delete[] (eliminate invalid auto_ptr use) to correct valgrind reported memory issues. 2009-10-30 10:31:54 -04:00
David Cole ccb0cf1306 Fix warnings in CMake source code. 2009-10-02 15:30:01 -04:00
David Cole 44bcba7461 Fix warnings in CMake source code. Suppress rampant warnings emanating from Qt files. 2009-10-01 16:47:08 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
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.
2009-09-28 11:43:28 -04:00
Brad King b41a548d86 Add parentheses around '&&' between '||' for gcc
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.
2009-09-11 08:18:15 -04:00
Brad King 57e14a4f97 COMP: Include <malloc.h> for 'free' on QNX 2009-07-13 17:08:38 -04:00
Brad King 724275b266 COMP: Include <stdlib.h> for 'free' 2009-07-13 16:46:53 -04:00
Brad King 3dd6f36d45 ENH: Add cmSystemTools::ParseUnixCommandLine
This method is a C++ wrapper around the KWSys System library function to
parse unix-style command lines.
2009-07-13 16:22:48 -04:00
Brad King b64aadc5b0 ENH: Remove unused cmSystemTools::RemoveEscapes
The RemoveEscapes method is no longer used anywhere.  All uses of it
have been replaced by a real lexer.  We can remove the method.
2009-06-24 15:09:50 -04:00
Bill Hoffman fdff8eb300 ENH: move PutEnv to SystemTools 2009-06-05 12:01:30 -04:00
Bill Hoffman ae95f656f3 ENH: vms fix 2009-04-24 11:44:42 -04:00
Brad King efe07c4e0a COMP: Fix calls to superclass methods for Borland
The superclass of cmSystemTools is cmsys::SystemTools, which should be
referencable by just SystemTools from inside the class.  Borland C++
does not seem to support this, so we use cmSystemTools instead.
2009-04-22 09:11:06 -04:00
Brad King 13e454f8d3 BUG: Avoid infinite loop at directory tree root
The system tools GetParentDirectory method no longer removes the root
path component.  This fixes cmSystemTools::FileExistsInParentDirectories
to not infinitely loop at when GetParentDirectory stops at the root.
2009-04-21 11:37:09 -04:00
Brad King 714d2fc04b ENH: Remove obscure method from KWSys SystemTools
This removes SystemTools::FileExistsInParentDirectories from KWSys since
it is a special-purpose method that is not generally useful.
2009-04-21 11:36:59 -04:00
Brad King 1ed7f381f1 COMP: Fix BOOL to bool conversion warning
The cmSystemTools::RenameFile method returns type bool, but its
implementation on Windows returns the result of an API function that
returns BOOL.  This change avoids the compiler warning.
2009-04-15 11:00:03 -04:00
Brad King d3363beb2f ENH: Move RenameFile to cmSystemTools
This moves the cmGeneratedFileStream::RenameFile method implementation
into cmSystemTools.  It works only within a single filesystem volume,
but is atomic when the operating system permits.
2009-04-15 09:57:57 -04:00
Brad King dc13914cd6 ENH: Create cmXMLSafe to help escapes in XML
This class provides easy syntax to efficiently insert blocks of data
into XML documents with proper escapes.  It replaces the old
cmCTest::MakeXMLSafe and cmSystemTools::MakeXMLSafe methods which
allocated extra memory instead of directly streaming the data.
2009-02-05 16:31:37 -05:00
Bill Hoffman 7f92b77997 BUG: fix crash with cmd.exe shell and cmake in the path 2009-01-20 10:06:39 -05:00
David Cole 306d517e82 COMP: Using the proper type for local variables can eliminate compiler warnings. 2008-11-26 15:41:16 -05:00
David Cole ceaef94ccc ENH: Implement feature request from issue 7885. Allow setting environment variables on a per-test basis for ctest using set_test_properties ENVIRONMENT. 2008-11-26 14:38:43 -05:00
Bill Hoffman 64fc597de2 ENH: add initial support for HAIKU OS from bug# 7425 2008-09-15 17:53:28 -04:00
Bill Hoffman 1629963e7c BUG: fix for 7045, use gcc for .m 2008-08-19 15:55:10 -04:00
Brad King ae60cc235c COMP: Work-around bogus compiler warning. 2008-08-15 09:47:21 -04:00
Brad King 8063dd293e ENH: Inform user when RPATH or RUNPATH is removed 2008-08-14 09:53:26 -04:00
Brad King 485c3faea7 BUG: Update both RPATH and RUNPATH entries
During installation the RPATH and RUNPATH entries of ELF binaries are
edited to match the user specification.  Usually either one entry is
present or both entries refer to the same string literal.  In the case
that they are both present and refer to separate string literals we need
to update both.  I have never seen this case in practice, but we should
do this just in case.
2008-08-14 09:53:21 -04:00
Brad King 2a85f8289f BUG: Remove both RPATH and RUNPATH entries
Removal of the RPATH and RUNPATH from ELF binaries must work when both
entries are present.  Both entries should be removed.  Previously only
one would be removed and the other would be blanked because it pointed
at the same string which was zeroed.  This fixes gentoo bug number
224901.
2008-08-14 09:53:17 -04:00
Brad King cea66664c5 ENH: Added WOW64 key view support to KWSys SystemTools' windows registry API.
- Add an argument to registry read/write/delete methods to specify
    a 32-bit or 64-bit view.
  - Default is the bit-ness of the running program.
  - See issue #7095.
2008-05-27 14:47:00 -04:00
Brad King 757875df91 ENH: Inform user when RPATH is set during installation.
- Original patch from Alex.
  - Modified to print only when RPATH is actually set.
2008-05-27 10:22:03 -04:00
Brad King b9a5dccc8d ENH: Added RPATH methods to cmSystemTools
- RemoveRPath to remove the RPATH from a binary
  - CheckRPath to check for an existing RPATH in a binary
2008-04-14 15:02:34 -04:00
Brad King 9b8404a305 COMP: Fix new cmSystemTools file time methods on Windows. 2008-04-14 12:44:01 -04:00
Brad King 703b8c8225 ENH: Added methods to cmSystemTools to save and restore file modification times. 2008-04-14 11:43:45 -04:00
Bill Hoffman 0a61a70870 BUG: undo change as it breaks preprocess test for some reason?? 2008-04-08 17:37:13 -04:00
Bill Hoffman 5a079b151a BUG: half fix for 6688, expand registry stuff on unix just like it was not found on windows 2008-04-08 16:06:44 -04:00