summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-12-18 15:43:24 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-12-18 15:43:24 (GMT)
commit0fafdb7eb8b710594448d2ccf61d3896b4ea8a17 (patch)
tree6da65828ed75b5509f1d9e2e0b178022a689abb2 /Source/cmFileCommand.cxx
parentf8c0dc27b56495a178cc711b594cd0f6395d942d (diff)
downloadCMake-0fafdb7eb8b710594448d2ccf61d3896b4ea8a17.zip
CMake-0fafdb7eb8b710594448d2ccf61d3896b4ea8a17.tar.gz
CMake-0fafdb7eb8b710594448d2ccf61d3896b4ea8a17.tar.bz2
BUG: Do not copy permissions of files when making the copy in an install rule. If the source file was read-only, this prevents the subsequent set of the destination file's modification time, making the copied file always different in time-stamp than the original and always installing a new file with a new time stamp (but the same content) causing unnecessary downstream incremental rebuilds. As part of this fix, add an optional copyPermissions parameter to the SystemTools routines CopyFileIfDifferent, CopyFileAlways, CopyAFile and CopyADirectory. The copyPermissions parameter defaults to true to preserve the behavior of these routines for existing callers.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 032d603..ca8e066 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1049,7 +1049,7 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
this->Makefile->DisplayStatus(message.c_str(), -1);
// Copy the file.
- if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true))
+ if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true, false))
{
cmOStringStream e;
e << "INSTALL cannot copy file \"" << fromFile
@@ -1064,7 +1064,13 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
// Set the file modification time of the destination file.
if(copy && !always)
{
- cmSystemTools::CopyFileTime(fromFile, toFile);
+ if (!cmSystemTools::CopyFileTime(fromFile, toFile))
+ {
+ cmOStringStream e;
+ e << "Problem setting modification time on file \"" << toFile << "\"";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
}
// Set permissions of the destination file.