|
@@ -25,19 +25,18 @@
|
|
|
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
|
|
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
|
|
|
const std::string &input,
|
|
const std::string &input,
|
|
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
|
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
|
|
|
- cmMakefile *makefile,
|
|
|
|
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
|
|
bool inputIsContent)
|
|
bool inputIsContent)
|
|
|
: Input(input),
|
|
: Input(input),
|
|
|
OutputFileExpr(outputFileExpr),
|
|
OutputFileExpr(outputFileExpr),
|
|
|
- Makefile(makefile),
|
|
|
|
|
Condition(condition),
|
|
Condition(condition),
|
|
|
InputIsContent(inputIsContent)
|
|
InputIsContent(inputIsContent)
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
-void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
|
|
|
|
|
|
+void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg,
|
|
|
|
|
+ const std::string& config,
|
|
|
const std::string& lang,
|
|
const std::string& lang,
|
|
|
cmCompiledGeneratorExpression* inputExpression,
|
|
cmCompiledGeneratorExpression* inputExpression,
|
|
|
std::map<std::string, std::string> &outputFiles, mode_t perm)
|
|
std::map<std::string, std::string> &outputFiles, mode_t perm)
|
|
@@ -45,7 +44,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
|
|
std::string rawCondition = this->Condition->GetInput();
|
|
std::string rawCondition = this->Condition->GetInput();
|
|
|
if (!rawCondition.empty())
|
|
if (!rawCondition.empty())
|
|
|
{
|
|
{
|
|
|
- std::string condResult = this->Condition->Evaluate(this->Makefile, config,
|
|
|
|
|
|
|
+ std::string condResult = this->Condition->Evaluate(lg->GetMakefile(),
|
|
|
|
|
+ config,
|
|
|
false, 0, 0, 0, lang);
|
|
false, 0, 0, 0, lang);
|
|
|
if (condResult == "0")
|
|
if (condResult == "0")
|
|
|
{
|
|
{
|
|
@@ -56,16 +56,17 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
|
|
std::ostringstream e;
|
|
std::ostringstream e;
|
|
|
e << "Evaluation file condition \"" << rawCondition << "\" did "
|
|
e << "Evaluation file condition \"" << rawCondition << "\" did "
|
|
|
"not evaluate to valid content. Got \"" << condResult << "\".";
|
|
"not evaluate to valid content. Got \"" << condResult << "\".";
|
|
|
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
|
|
|
|
+ lg->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const std::string outputFileName
|
|
const std::string outputFileName
|
|
|
- = this->OutputFileExpr->Evaluate(this->Makefile, config,
|
|
|
|
|
|
|
+ = this->OutputFileExpr->Evaluate(lg->GetMakefile(), config,
|
|
|
false, 0, 0, 0, lang);
|
|
false, 0, 0, 0, lang);
|
|
|
const std::string outputContent
|
|
const std::string outputContent
|
|
|
- = inputExpression->Evaluate(this->Makefile, config,
|
|
|
|
|
|
|
+ = inputExpression->Evaluate(lg->GetMakefile(),
|
|
|
|
|
+ config,
|
|
|
false, 0, 0, 0, lang);
|
|
false, 0, 0, 0, lang);
|
|
|
|
|
|
|
|
std::map<std::string, std::string>::iterator it
|
|
std::map<std::string, std::string>::iterator it
|
|
@@ -81,11 +82,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
|
|
e << "Evaluation file to be written multiple times for different "
|
|
e << "Evaluation file to be written multiple times for different "
|
|
|
"configurations or languages with different content:\n "
|
|
"configurations or languages with different content:\n "
|
|
|
<< outputFileName;
|
|
<< outputFileName;
|
|
|
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
|
|
|
|
+ lg->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this->Makefile->AddCMakeOutputFile(outputFileName.c_str());
|
|
|
|
|
|
|
+ lg->GetMakefile()->AddCMakeOutputFile(outputFileName.c_str());
|
|
|
this->Files.push_back(outputFileName);
|
|
this->Files.push_back(outputFileName);
|
|
|
outputFiles[outputFileName] = outputContent;
|
|
outputFiles[outputFileName] = outputContent;
|
|
|
|
|
|
|
@@ -100,18 +101,19 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
|
void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
|
|
- std::string const& config)
|
|
|
|
|
|
|
+ cmLocalGenerator *lg, std::string const& config)
|
|
|
{
|
|
{
|
|
|
std::vector<std::string> enabledLanguages;
|
|
std::vector<std::string> enabledLanguages;
|
|
|
- cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator();
|
|
|
|
|
|
|
+ cmGlobalGenerator *gg = lg->GetGlobalGenerator();
|
|
|
gg->GetEnabledLanguages(enabledLanguages);
|
|
gg->GetEnabledLanguages(enabledLanguages);
|
|
|
|
|
|
|
|
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
|
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
|
|
le != enabledLanguages.end(); ++le)
|
|
le != enabledLanguages.end(); ++le)
|
|
|
{
|
|
{
|
|
|
- std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config,
|
|
|
|
|
|
|
+ std::string name = this->OutputFileExpr->Evaluate(lg->GetMakefile(),
|
|
|
|
|
+ config,
|
|
|
false, 0, 0, 0, *le);
|
|
false, 0, 0, 0, *le);
|
|
|
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(name);
|
|
|
|
|
|
|
+ cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource(name);
|
|
|
sf->SetProperty("GENERATED", "1");
|
|
sf->SetProperty("GENERATED", "1");
|
|
|
|
|
|
|
|
gg->SetFilenameTargetDepends(sf,
|
|
gg->SetFilenameTargetDepends(sf,
|
|
@@ -120,7 +122,7 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
-void cmGeneratorExpressionEvaluationFile::Generate()
|
|
|
|
|
|
|
+void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator *lg)
|
|
|
{
|
|
{
|
|
|
mode_t perm = 0;
|
|
mode_t perm = 0;
|
|
|
std::string inputContent;
|
|
std::string inputContent;
|
|
@@ -130,14 +132,14 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- this->Makefile->AddCMakeDependFile(this->Input.c_str());
|
|
|
|
|
|
|
+ lg->GetMakefile()->AddCMakeDependFile(this->Input.c_str());
|
|
|
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
|
|
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
|
|
|
cmsys::ifstream fin(this->Input.c_str());
|
|
cmsys::ifstream fin(this->Input.c_str());
|
|
|
if(!fin)
|
|
if(!fin)
|
|
|
{
|
|
{
|
|
|
std::ostringstream e;
|
|
std::ostringstream e;
|
|
|
e << "Evaluation file \"" << this->Input << "\" cannot be read.";
|
|
e << "Evaluation file \"" << this->Input << "\" cannot be read.";
|
|
|
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
|
|
|
|
+ lg->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -159,7 +161,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
|
|
std::map<std::string, std::string> outputFiles;
|
|
std::map<std::string, std::string> outputFiles;
|
|
|
|
|
|
|
|
std::vector<std::string> allConfigs;
|
|
std::vector<std::string> allConfigs;
|
|
|
- this->Makefile->GetConfigurations(allConfigs);
|
|
|
|
|
|
|
+ lg->GetMakefile()->GetConfigurations(allConfigs);
|
|
|
|
|
|
|
|
if (allConfigs.empty())
|
|
if (allConfigs.empty())
|
|
|
{
|
|
{
|
|
@@ -167,7 +169,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::string> enabledLanguages;
|
|
std::vector<std::string> enabledLanguages;
|
|
|
- cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator();
|
|
|
|
|
|
|
+ cmGlobalGenerator *gg = lg->GetGlobalGenerator();
|
|
|
gg->GetEnabledLanguages(enabledLanguages);
|
|
gg->GetEnabledLanguages(enabledLanguages);
|
|
|
|
|
|
|
|
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
|
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
|
@@ -176,7 +178,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
|
|
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
|
|
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
|
|
|
li != allConfigs.end(); ++li)
|
|
li != allConfigs.end(); ++li)
|
|
|
{
|
|
{
|
|
|
- this->Generate(*li, *le, inputExpression.get(), outputFiles, perm);
|
|
|
|
|
|
|
+ this->Generate(lg, *li, *le, inputExpression.get(), outputFiles, perm);
|
|
|
if(cmSystemTools::GetFatalErrorOccured())
|
|
if(cmSystemTools::GetFatalErrorOccured())
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|