cmMakefile: Store container of cmExportBuildFileGenerators.
Set a cmLocalGenerator on each instance at compute time. That will soon be needed to access cmGeneratorTarget instances. If a cmExportBuildFileGenerator is processed early during configure time as a result of CMP0024 it must be removed from the list to process later at generate time.
This commit is contained in:
parent
1583440509
commit
488723f5cd
@ -18,12 +18,17 @@
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
|
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
|
||||||
: Backtrace()
|
|
||||||
{
|
{
|
||||||
this->Makefile = 0;
|
this->LG = 0;
|
||||||
this->ExportSet = 0;
|
this->ExportSet = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
|
||||||
|
{
|
||||||
|
this->LG = lg;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
||||||
{
|
{
|
||||||
@ -37,7 +42,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
|||||||
tei = targets.begin();
|
tei = targets.begin();
|
||||||
tei != targets.end(); ++tei)
|
tei != targets.end(); ++tei)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget *te = this->Makefile
|
cmGeneratorTarget *te = this->LG->GetMakefile()
|
||||||
->FindGeneratorTargetToUse(*tei);
|
->FindGeneratorTargetToUse(*tei);
|
||||||
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
|
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
|
||||||
sep = " ";
|
sep = " ";
|
||||||
@ -49,8 +54,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
|||||||
{
|
{
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "given target \"" << te->GetName() << "\" more than once.";
|
e << "given target \"" << te->GetName() << "\" more than once.";
|
||||||
this->Makefile->GetCMakeInstance()
|
this->LG->GetGlobalGenerator()->GetCMakeInstance()
|
||||||
->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
|
->IssueMessage(cmake::FATAL_ERROR, e.str(),
|
||||||
|
this->LG->GetMakefile()->GetBacktrace());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
|
if (te->GetType() == cmTarget::INTERFACE_LIBRARY)
|
||||||
@ -328,8 +334,9 @@ cmExportBuildFileGenerator
|
|||||||
e << "If the required target is not easy to reference in this call, "
|
e << "If the required target is not easy to reference in this call, "
|
||||||
<< "consider using the APPEND option with multiple separate calls.";
|
<< "consider using the APPEND option with multiple separate calls.";
|
||||||
|
|
||||||
this->Makefile->GetCMakeInstance()
|
this->LG->GetGlobalGenerator()->GetCMakeInstance()
|
||||||
->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace);
|
->IssueMessage(cmake::FATAL_ERROR, e.str(),
|
||||||
|
this->LG->GetMakefile()->GetBacktrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
|
@ -43,10 +43,7 @@ public:
|
|||||||
/** Set whether to append generated code to the output file. */
|
/** Set whether to append generated code to the output file. */
|
||||||
void SetAppendMode(bool append) { this->AppendMode = append; }
|
void SetAppendMode(bool append) { this->AppendMode = append; }
|
||||||
|
|
||||||
void SetMakefile(cmMakefile *mf) {
|
void Compute(cmLocalGenerator* lg);
|
||||||
this->Makefile = mf;
|
|
||||||
this->Backtrace = this->Makefile->GetBacktrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Implement virtual methods from the superclass.
|
// Implement virtual methods from the superclass.
|
||||||
@ -80,8 +77,7 @@ protected:
|
|||||||
std::vector<std::string> Targets;
|
std::vector<std::string> Targets;
|
||||||
cmExportSet *ExportSet;
|
cmExportSet *ExportSet;
|
||||||
std::vector<cmGeneratorTarget*> Exports;
|
std::vector<cmGeneratorTarget*> Exports;
|
||||||
cmMakefile* Makefile;
|
cmLocalGenerator* LG;
|
||||||
cmListFileBacktrace Backtrace;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,7 +221,7 @@ bool cmExportCommand
|
|||||||
{
|
{
|
||||||
ebfg->SetTargets(targets);
|
ebfg->SetTargets(targets);
|
||||||
}
|
}
|
||||||
ebfg->SetMakefile(this->Makefile);
|
this->Makefile->AddExportBuildFileGenerator(ebfg);
|
||||||
ebfg->SetExportOld(this->ExportOld.IsEnabled());
|
ebfg->SetExportOld(this->ExportOld.IsEnabled());
|
||||||
|
|
||||||
// Compute the set of configurations exported.
|
// Compute the set of configurations exported.
|
||||||
|
@ -73,7 +73,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
|
|||||||
this->CurrentMakefile = 0;
|
this->CurrentMakefile = 0;
|
||||||
this->TryCompileOuterMakefile = 0;
|
this->TryCompileOuterMakefile = 0;
|
||||||
|
|
||||||
this->ConfigureDoneCMP0026 = false;
|
this->ConfigureDoneCMP0026AndCMP0024 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalGenerator::~cmGlobalGenerator()
|
cmGlobalGenerator::~cmGlobalGenerator()
|
||||||
@ -234,6 +234,16 @@ bool cmGlobalGenerator::GenerateImportFile(const std::string &file)
|
|||||||
if (it != this->BuildExportSets.end())
|
if (it != this->BuildExportSets.end())
|
||||||
{
|
{
|
||||||
bool result = it->second->GenerateImportFile();
|
bool result = it->second->GenerateImportFile();
|
||||||
|
|
||||||
|
if (!this->ConfigureDoneCMP0026AndCMP0024)
|
||||||
|
{
|
||||||
|
for (std::vector<cmMakefile*>::const_iterator mit =
|
||||||
|
this->Makefiles.begin(); mit != this->Makefiles.end(); ++mit)
|
||||||
|
{
|
||||||
|
(*mit)->RemoveExportBuildFileGeneratorCMP0024(it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete it->second;
|
delete it->second;
|
||||||
it->second = 0;
|
it->second = 0;
|
||||||
this->BuildExportSets.erase(it);
|
this->BuildExportSets.erase(it);
|
||||||
@ -1122,11 +1132,11 @@ void cmGlobalGenerator::Configure()
|
|||||||
this->CMakeInstance->GetHomeOutputDirectory());
|
this->CMakeInstance->GetHomeOutputDirectory());
|
||||||
|
|
||||||
// now do it
|
// now do it
|
||||||
this->ConfigureDoneCMP0026 = false;
|
this->ConfigureDoneCMP0026AndCMP0024 = false;
|
||||||
dirMf->Configure();
|
dirMf->Configure();
|
||||||
dirMf->EnforceDirectoryLevelRules();
|
dirMf->EnforceDirectoryLevelRules();
|
||||||
|
|
||||||
this->ConfigureDoneCMP0026 = true;
|
this->ConfigureDoneCMP0026AndCMP0024 = true;
|
||||||
|
|
||||||
// Put a copy of each global target in every directory.
|
// Put a copy of each global target in every directory.
|
||||||
cmTargets globalTargets;
|
cmTargets globalTargets;
|
||||||
@ -1226,6 +1236,20 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmGlobalGenerator::ComputeBuildFileGenerators()
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
|
{
|
||||||
|
std::vector<cmExportBuildFileGenerator*> gens =
|
||||||
|
this->Makefiles[i]->GetExportBuildFileGenerators();
|
||||||
|
for (std::vector<cmExportBuildFileGenerator*>::const_iterator it =
|
||||||
|
gens.begin(); it != gens.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->Compute(this->LocalGenerators[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool cmGlobalGenerator::Compute()
|
bool cmGlobalGenerator::Compute()
|
||||||
{
|
{
|
||||||
// Some generators track files replaced during the Generate.
|
// Some generators track files replaced during the Generate.
|
||||||
@ -1255,6 +1279,8 @@ bool cmGlobalGenerator::Compute()
|
|||||||
this->CreateQtAutoGeneratorsTargets();
|
this->CreateQtAutoGeneratorsTargets();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
this->ComputeBuildFileGenerators();
|
||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
// Add generator specific helper commands
|
// Add generator specific helper commands
|
||||||
|
@ -362,7 +362,10 @@ public:
|
|||||||
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
|
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool GetConfigureDoneCMP0026() const { return this->ConfigureDoneCMP0026; }
|
bool GetConfigureDoneCMP0026() const
|
||||||
|
{ return this->ConfigureDoneCMP0026AndCMP0024; }
|
||||||
|
|
||||||
|
void ComputeBuildFileGenerators();
|
||||||
|
|
||||||
std::string MakeSilentFlag;
|
std::string MakeSilentFlag;
|
||||||
protected:
|
protected:
|
||||||
@ -520,7 +523,7 @@ protected:
|
|||||||
bool ForceUnixPaths;
|
bool ForceUnixPaths;
|
||||||
bool ToolSupportsColor;
|
bool ToolSupportsColor;
|
||||||
bool InstallTargetEnabled;
|
bool InstallTargetEnabled;
|
||||||
bool ConfigureDoneCMP0026;
|
bool ConfigureDoneCMP0026AndCMP0024;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -126,6 +126,7 @@ bool cmIncludeCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gg->CreateGenerationObjects();
|
gg->CreateGenerationObjects();
|
||||||
|
gg->ComputeBuildFileGenerators();
|
||||||
gg->GenerateImportFile(fname_abs);
|
gg->GenerateImportFile(fname_abs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,6 +702,29 @@ cmMakefile::GetEvaluationFiles() const
|
|||||||
return this->EvaluationFiles;
|
return this->EvaluationFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<cmExportBuildFileGenerator*>
|
||||||
|
cmMakefile::GetExportBuildFileGenerators() const
|
||||||
|
{
|
||||||
|
return this->ExportBuildFileGenerators;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmMakefile::RemoveExportBuildFileGeneratorCMP0024(
|
||||||
|
cmExportBuildFileGenerator* gen)
|
||||||
|
{
|
||||||
|
std::vector<cmExportBuildFileGenerator*>::iterator it =
|
||||||
|
std::find(this->ExportBuildFileGenerators.begin(),
|
||||||
|
this->ExportBuildFileGenerators.end(), gen);
|
||||||
|
if(it != this->ExportBuildFileGenerators.end())
|
||||||
|
{
|
||||||
|
this->ExportBuildFileGenerators.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmMakefile::AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen)
|
||||||
|
{
|
||||||
|
this->ExportBuildFileGenerators.push_back(gen);
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
struct file_not_persistent
|
struct file_not_persistent
|
||||||
|
@ -51,6 +51,7 @@ class cmake;
|
|||||||
class cmMakefileCall;
|
class cmMakefileCall;
|
||||||
class cmCMakePolicyCommand;
|
class cmCMakePolicyCommand;
|
||||||
class cmGeneratorExpressionEvaluationFile;
|
class cmGeneratorExpressionEvaluationFile;
|
||||||
|
class cmExportBuildFileGenerator;
|
||||||
|
|
||||||
/** \class cmMakefile
|
/** \class cmMakefile
|
||||||
* \brief Process the input CMakeLists.txt file.
|
* \brief Process the input CMakeLists.txt file.
|
||||||
@ -789,6 +790,11 @@ public:
|
|||||||
bool inputIsContent);
|
bool inputIsContent);
|
||||||
std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
|
std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
|
||||||
|
|
||||||
|
std::vector<cmExportBuildFileGenerator*>
|
||||||
|
GetExportBuildFileGenerators() const;
|
||||||
|
void RemoveExportBuildFileGeneratorCMP0024(cmExportBuildFileGenerator* gen);
|
||||||
|
void AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// add link libraries and directories to the target
|
// add link libraries and directories to the target
|
||||||
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
|
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
|
||||||
@ -882,6 +888,7 @@ private:
|
|||||||
mutable cmsys::RegularExpression cmNamedCurly;
|
mutable cmsys::RegularExpression cmNamedCurly;
|
||||||
|
|
||||||
std::vector<cmMakefile*> UnConfiguredDirectories;
|
std::vector<cmMakefile*> UnConfiguredDirectories;
|
||||||
|
std::vector<cmExportBuildFileGenerator*> ExportBuildFileGenerators;
|
||||||
|
|
||||||
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
|
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
|
||||||
|
|
||||||
|
@ -261,6 +261,7 @@ CMAKE_CXX_SOURCES="\
|
|||||||
cmPropertyDefinitionMap \
|
cmPropertyDefinitionMap \
|
||||||
cmMakeDepend \
|
cmMakeDepend \
|
||||||
cmMakefile \
|
cmMakefile \
|
||||||
|
cmExportBuildFileGenerator \
|
||||||
cmExportFileGenerator \
|
cmExportFileGenerator \
|
||||||
cmExportInstallFileGenerator \
|
cmExportInstallFileGenerator \
|
||||||
cmExportTryCompileFileGenerator \
|
cmExportTryCompileFileGenerator \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user