summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-06-03 15:57:02 (GMT)
committerBrad King <brad.king@kitware.com>2010-06-03 15:57:02 (GMT)
commitb8a1319c354b7f257e6c0b82e428cfe94dcbf4ff (patch)
tree07540e6631e202171b6a7c99557823508825682e /Source
parent3ac3dea6f0eb1ce68b321020ecdd336b3db8a0fe (diff)
downloadCMake-b8a1319c354b7f257e6c0b82e428cfe94dcbf4ff.zip
CMake-b8a1319c354b7f257e6c0b82e428cfe94dcbf4ff.tar.gz
CMake-b8a1319c354b7f257e6c0b82e428cfe94dcbf4ff.tar.bz2
Avoid use of CopyAFile "copyPermissions" parameter
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.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileCommand.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5611527..60a81f3 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1507,7 +1507,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
this->ReportCopy(toFile, TypeFile, copy);
// Copy the file.
- if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true, false))
+ if(copy && !cmSystemTools::CopyAFile(fromFile, toFile, true))
{
cmOStringStream e;
e << this->Name << " cannot copy file \"" << fromFile
@@ -1519,6 +1519,13 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile,
// Set the file modification time of the destination file.
if(copy && !this->Always)
{
+ // Add write permission so we can set the file time.
+ // Permissions are set unconditionally below anyway.
+ mode_t perm = 0;
+ if(cmSystemTools::GetPermissions(toFile, perm))
+ {
+ cmSystemTools::SetPermissions(toFile, perm | mode_owner_write);
+ }
if (!cmSystemTools::CopyFileTime(fromFile, toFile))
{
cmOStringStream e;