summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-06-23 17:52:17 (GMT)
committerBrad King <brad.king@kitware.com>2014-06-24 16:52:11 (GMT)
commitf701b0b7f7eb4a7cd6fe96f285835b03604fb477 (patch)
tree50370d99ea3685f29d7be60576ec7ef5284181f4 /Source/cmFileCommand.cxx
parentf0a0196250de349e97fe579165f7a9b580ed63e8 (diff)
downloadCMake-f701b0b7f7eb4a7cd6fe96f285835b03604fb477.zip
CMake-f701b0b7f7eb4a7cd6fe96f285835b03604fb477.tar.gz
CMake-f701b0b7f7eb4a7cd6fe96f285835b03604fb477.tar.bz2
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.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx23
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 655f3ba..83f356a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2057,23 +2057,26 @@ bool cmFileInstaller::HandleInstallDestination()
this->DestDirLength = int(sdestdir.size());
}
- if ( !cmSystemTools::FileExists(destination.c_str()) )
+ if(this->InstallType != cmInstallType_DIRECTORY)
{
- if ( !cmSystemTools::MakeDirectory(destination.c_str()) )
+ if ( !cmSystemTools::FileExists(destination.c_str()) )
{
- std::string errstring = "cannot create directory: " + destination +
+ if ( !cmSystemTools::MakeDirectory(destination.c_str()) )
+ {
+ std::string errstring = "cannot create directory: " + destination +
". Maybe need administrative privileges.";
+ this->FileCommand->SetError(errstring);
+ return false;
+ }
+ }
+ if ( !cmSystemTools::FileIsDirectory(destination.c_str()) )
+ {
+ std::string errstring = "INSTALL destination: " + destination +
+ " is not a directory.";
this->FileCommand->SetError(errstring);
return false;
}
}
- if ( !cmSystemTools::FileIsDirectory(destination.c_str()) )
- {
- std::string errstring = "INSTALL destination: " + destination +
- " is not a directory.";
- this->FileCommand->SetError(errstring);
- return false;
- }
return true;
}