summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-07-02 15:51:30 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-07-02 15:51:30 (GMT)
commit04a8572b9985a7c7c3eec95e52bc1ce144f39c8f (patch)
treeae0fdece007f851e0c90736fb39351412c854ac2
parent9d61ea38ddc8cbc657e1f847e940aa3602d1b811 (diff)
downloadCMake-04a8572b9985a7c7c3eec95e52bc1ce144f39c8f.zip
CMake-04a8572b9985a7c7c3eec95e52bc1ce144f39c8f.tar.gz
CMake-04a8572b9985a7c7c3eec95e52bc1ce144f39c8f.tar.bz2
BUG: If the destination is the same as source, do not copy file. Fixes Bug #956 - make install broken
-rw-r--r--Source/cmFileCommand.cxx73
1 files changed, 38 insertions, 35 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 471b92a..a1d85b2 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -549,51 +549,54 @@ bool cmFileCommand::HandleInstallCommand(
break;
}
- if ( cmSystemTools::FileExists(ctarget.c_str()) )
+ if ( !cmSystemTools::SameFile(ctarget.c_str(), destfile.c_str()) )
{
- cmSystemTools::RemoveFile(destfile.c_str());
- if ( !cmSystemTools::CopyFileAlways(ctarget.c_str(),
- destination.c_str()) )
+ if ( cmSystemTools::FileExists(ctarget.c_str()) )
{
- std::string errstring = "cannot copy file: " + ctarget +
- " to directory : " + destination + ".";
- this->SetError(errstring.c_str());
- return false;
- }
- switch( itype )
- {
- case cmTarget::MODULE_LIBRARY:
- case cmTarget::SHARED_LIBRARY:
- case cmTarget::EXECUTABLE:
- case cmTarget::INSTALL_PROGRAMS:
+ cmSystemTools::RemoveFile(destfile.c_str());
+ if ( !cmSystemTools::CopyFileAlways(ctarget.c_str(),
+ destination.c_str()) )
+ {
+ std::string errstring = "cannot copy file: " + ctarget +
+ " to directory : " + destination + ".";
+ this->SetError(errstring.c_str());
+ return false;
+ }
+ switch( itype )
+ {
+ case cmTarget::MODULE_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::EXECUTABLE:
+ case cmTarget::INSTALL_PROGRAMS:
- if ( !cmSystemTools::SetPermissions(destfile.c_str(),
+ if ( !cmSystemTools::SetPermissions(destfile.c_str(),
#if defined( _MSC_VER ) || defined( __MINGW32__ )
- S_IREAD | S_IWRITE | S_IEXEC
+ S_IREAD | S_IWRITE | S_IEXEC
#elif defined( __BORLANDC__ )
- S_IRUSR | S_IWUSR | S_IXUSR
+ S_IRUSR | S_IWUSR | S_IXUSR
#else
- S_IRUSR | S_IWUSR | S_IXUSR |
- S_IRGRP | S_IXGRP |
- S_IROTH | S_IXOTH
+ S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IXGRP |
+ S_IROTH | S_IXOTH
#endif
- ) )
- {
- cmOStringStream err;
- err << "Problem setting permissions on file: " << destfile.c_str();
- perror(err.str().c_str());
+ ) )
+ {
+ cmOStringStream err;
+ err << "Problem setting permissions on file: " << destfile.c_str();
+ perror(err.str().c_str());
+ }
}
+ smanifest_files += ";" + destfile;
}
- smanifest_files += ";" + destfile;
- }
- else
- {
- if ( !optional )
+ else
{
- std::string errstring = "cannot find file: " +
- ctarget + " to install.";
- this->SetError(errstring.c_str());
- return false;
+ if ( !optional )
+ {
+ std::string errstring = "cannot find file: " +
+ ctarget + " to install.";
+ this->SetError(errstring.c_str());
+ return false;
+ }
}
}
}