[Cmake-commits] [cmake-commits] king committed cmInstallExportGenerator.cxx 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jan 7 14:16:42 EST 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv3959/Source

Modified Files:
	cmInstallExportGenerator.cxx 
Log Message:
ENH: Clean per-config export files during install

When installing the main export file the install tree may be dirty.  If
out-dated per-config files exist they may break the newly installed main
file which when it globs them.  This teaches the installation script to
detect when it is about to replace the main export file with a different
one and cleans out any existing per-config files.


Index: cmInstallExportGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallExportGenerator.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -C 2 -d -r1.8 -r1.9
*** cmInstallExportGenerator.cxx	28 Jan 2008 13:38:35 -0000	1.8
--- cmInstallExportGenerator.cxx	7 Jan 2009 19:16:40 -0000	1.9
***************
*** 204,207 ****
--- 204,231 ----
                                                       Indent const& indent)
  {
+   // Remove old per-configuration export files if the main changes.
+   std::string installedDir = "$ENV{DESTDIR}";
+   installedDir += this->GetInstallDestination();
+   installedDir += "/";
+   std::string installedFile = installedDir;
+   installedFile += this->FileName;
+   os << indent << "IF(EXISTS \"" << installedFile << "\")\n";
+   Indent indentN = indent.Next();
+   Indent indentNN = indentN.Next();
+   Indent indentNNN = indentNN.Next();
+   os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n"
+      << indentN << "     \"" << installedFile << "\"\n"
+      << indentN << "     \"" << this->MainImportFile << "\")\n";
+   os << indentN << "IF(EXPORT_FILE_CHANGED)\n";
+   os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir
+      << this->EFGen->GetConfigImportFileGlob() << "\")\n";
+   os << indentNN << "IF(OLD_CONFIG_FILES)\n";
+   os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile
+      << "\\\" will be replaced.  Removing files [${OLD_CONFIG_FILES}].\")\n";
+   os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n";
+   os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n";
+   os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n";
+   os << indent << "ENDIF()\n";
+ 
    // Install the main export file.
    std::vector<std::string> files;



More information about the Cmake-commits mailing list