[Cmake-commits] [cmake-commits] king committed cmFileCommand.cxx 1.123 1.124
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Apr 29 08:46:40 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv30705/Source
Modified Files:
cmFileCommand.cxx
Log Message:
ENH: Simplify CMAKE_INSTALL_ALWAYS implementation
This simplifies cmFileInstaller internally by storing the 'always' mark
as an instance variable instead of passing it through all method
signatures.
Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.123
retrieving revision 1.124
diff -C 2 -d -r1.123 -r1.124
*** cmFileCommand.cxx 29 Apr 2009 12:46:21 -0000 1.123
--- cmFileCommand.cxx 29 Apr 2009 12:46:36 -0000 1.124
***************
*** 905,917 ****
{
// Methods to actually install files.
! bool InstallFile(const char* fromFile, const char* toFile, bool always);
! bool InstallDirectory(const char* source, const char* destination,
! bool always);
// All instances need the file command and makefile using them.
cmFileInstaller(cmFileCommand* command):
FileCommand(command), Makefile(command->GetMakefile()),
! DestDirLength(0), MatchlessFiles(true)
{
// Get the current manifest.
this->Manifest =
--- 905,919 ----
{
// Methods to actually install files.
! bool InstallFile(const char* fromFile, const char* toFile);
! bool InstallDirectory(const char* source, const char* destination);
// All instances need the file command and makefile using them.
cmFileInstaller(cmFileCommand* command):
FileCommand(command), Makefile(command->GetMakefile()),
! Always(false), DestDirLength(0), MatchlessFiles(true)
{
+ // Check whether to copy files always or only if they have changed.
+ this->Always =
+ cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_INSTALL_ALWAYS"));
// Get the current manifest.
this->Manifest =
***************
*** 928,931 ****
--- 930,934 ----
cmFileCommand* FileCommand;
cmMakefile* Makefile;
+ bool Always;
cmFileTimeComparison FileTimes;
public:
***************
*** 1023,1032 ****
private:
! bool InstallSymlink(const char* fromFile, const char* toFile, bool always);
};
//----------------------------------------------------------------------------
! bool cmFileInstaller::InstallSymlink(const char* fromFile, const char* toFile,
! bool always)
{
// Read the original symlink.
--- 1026,1034 ----
private:
! bool InstallSymlink(const char* fromFile, const char* toFile);
};
//----------------------------------------------------------------------------
! bool cmFileInstaller::InstallSymlink(const char* fromFile, const char* toFile)
{
// Read the original symlink.
***************
*** 1044,1048 ****
// always installing.
bool copy = true;
! if(!always)
{
std::string oldSymlinkTarget;
--- 1046,1050 ----
// always installing.
bool copy = true;
! if(!this->Always)
{
std::string oldSymlinkTarget;
***************
*** 1084,1089 ****
//----------------------------------------------------------------------------
! bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile,
! bool always)
{
// Collect any properties matching this file name.
--- 1086,1090 ----
//----------------------------------------------------------------------------
! bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile)
{
// Collect any properties matching this file name.
***************
*** 1100,1109 ****
if(cmSystemTools::FileIsSymlink(fromFile))
{
! return this->InstallSymlink(fromFile, toFile, always);
}
// Determine whether we will copy the file.
bool copy = true;
! if(!always)
{
// If both files exist with the same time do not copy.
--- 1101,1110 ----
if(cmSystemTools::FileIsSymlink(fromFile))
{
! return this->InstallSymlink(fromFile, toFile);
}
// Determine whether we will copy the file.
bool copy = true;
! if(!this->Always)
{
// If both files exist with the same time do not copy.
***************
*** 1133,1137 ****
// Set the file modification time of the destination file.
! if(copy && !always)
{
if (!cmSystemTools::CopyFileTime(fromFile, toFile))
--- 1134,1138 ----
// Set the file modification time of the destination file.
! if(copy && !this->Always)
{
if (!cmSystemTools::CopyFileTime(fromFile, toFile))
***************
*** 1166,1171 ****
//----------------------------------------------------------------------------
bool cmFileInstaller::InstallDirectory(const char* source,
! const char* destination,
! bool always)
{
// Collect any properties matching this directory name.
--- 1167,1171 ----
//----------------------------------------------------------------------------
bool cmFileInstaller::InstallDirectory(const char* source,
! const char* destination)
{
// Collect any properties matching this directory name.
***************
*** 1182,1186 ****
if(cmSystemTools::FileIsSymlink(source))
{
! return this->InstallSymlink(source, destination, always);
}
--- 1182,1186 ----
if(cmSystemTools::FileIsSymlink(source))
{
! return this->InstallSymlink(source, destination);
}
***************
*** 1257,1261 ****
toDir += "/";
toDir += dir.GetFile(fileNum);
! if(!this->InstallDirectory(fromPath.c_str(), toDir.c_str(), always))
{
return false;
--- 1257,1261 ----
toDir += "/";
toDir += dir.GetFile(fileNum);
! if(!this->InstallDirectory(fromPath.c_str(), toDir.c_str()))
{
return false;
***************
*** 1268,1272 ****
toFile += "/";
toFile += dir.GetFile(fileNum);
! if(!this->InstallFile(fromPath.c_str(), toFile.c_str(), always))
{
return false;
--- 1268,1272 ----
toFile += "/";
toFile += dir.GetFile(fileNum);
! if(!this->InstallFile(fromPath.c_str(), toFile.c_str()))
{
return false;
***************
*** 2042,2050 ****
typedef std::set<cmStdString>::const_iterator iter_type;
- // Check whether files should be copied always or only if they have
- // changed.
- bool copy_always =
- cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_INSTALL_ALWAYS"));
-
// Handle each file listed.
for (std::vector<std::string>::size_type i = 0; i < files.size(); i ++ )
--- 2042,2045 ----
***************
*** 2083,2088 ****
{
// Try installing this directory.
! if(!installer.InstallDirectory(fromFile.c_str(), toFile.c_str(),
! copy_always))
{
return false;
--- 2078,2082 ----
{
// Try installing this directory.
! if(!installer.InstallDirectory(fromFile.c_str(), toFile.c_str()))
{
return false;
***************
*** 2092,2097 ****
{
// Install this file.
! if(!installer.InstallFile(fromFile.c_str(), toFile.c_str(),
! copy_always))
{
return false;
--- 2086,2090 ----
{
// Install this file.
! if(!installer.InstallFile(fromFile.c_str(), toFile.c_str()))
{
return false;
More information about the Cmake-commits
mailing list