Просмотр исходного кода

ENH: add support for re-running cmake if the cmakefiles change

Bill Hoffman 19 лет назад
Родитель
Сommit
8c06f8e294
3 измененных файлов с 17 добавлено и 1 удалено
  1. 7 0
      Source/cmGlobalUnixMakefileGenerator3.cxx
  2. 1 0
      Source/cmMakefile.cxx
  3. 9 1
      Source/cmMakefile.h

+ 7 - 0
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -287,6 +287,13 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
     tmpStr += "/CMakeFiles/CMakeDirectoryInformation.cmake";
     cmakefileStream << "  \"" << 
       lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n";
+    const std::vector<std::string>& outfiles = lg->GetMakefile()->GetOutputFiles();
+    for(std::vector<std::string>::const_iterator k= outfiles.begin();
+        k != outfiles.end(); ++k)
+      {
+      cmakefileStream << "  \"" << 
+        lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n";
+      }
     }
   cmakefileStream << "  )\n\n";
 

+ 1 - 0
Source/cmMakefile.cxx

@@ -2368,6 +2368,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
   std::string soutfile = outfile;
   std::string sinfile = infile;
   this->AddCMakeDependFile(infile);
+  this->AddCMakeOutputFile(outfile);
   cmSystemTools::ConvertToUnixSlashes(soutfile);
   mode_t perm = 0;
   cmSystemTools::GetPermissions(sinfile.c_str(), perm);

+ 9 - 1
Source/cmMakefile.h

@@ -524,11 +524,18 @@ public:
    */
   const std::vector<std::string>& GetListFiles() const
     { return this->ListFiles; }
-  
   ///! When the file changes cmake will be re-run from the build system.
   void AddCMakeDependFile(const char* file)
     { this->ListFiles.push_back(file);}
   
+  /**
+   * Get the vector of  files created by this makefile
+   */
+  const std::vector<std::string>& GetOutputFiles() const
+    { return this->OutputFiles; }
+  void AddCMakeOutputFile(const char* file)
+    { this->ListFiles.push_back(file);}
+  
   /**
    * Expand all defined variables in the string.  
    * Defined variables come from the this->Definitions map.
@@ -709,6 +716,7 @@ protected:
   std::vector<std::string> LinkDirectories;
   
   std::vector<std::string> ListFiles; // list of command files loaded
+  std::vector<std::string> OutputFiles; // list of command files loaded
   
   
   cmTarget::LinkLibraryVectorType LinkLibraries;