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

This commit is contained in:
Bill Hoffman 2006-04-10 13:53:00 -04:00
parent 3df8a59374
commit 8c06f8e294
3 changed files with 17 additions and 1 deletions

View File

@ -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";

View File

@ -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);

View File

@ -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;