cmTestGenerator: Require cmLocalGenerator, not cmMakefile.
This commit is contained in:
parent
75e511eeaf
commit
c259b83026
|
@ -196,6 +196,7 @@ void cmLocalGenerator::GenerateTestFiles()
|
||||||
for(std::vector<cmTestGenerator*>::const_iterator gi = testers.begin();
|
for(std::vector<cmTestGenerator*>::const_iterator gi = testers.begin();
|
||||||
gi != testers.end(); ++gi)
|
gi != testers.end(); ++gi)
|
||||||
{
|
{
|
||||||
|
(*gi)->Compute(this);
|
||||||
(*gi)->Generate(fout, config, configurationTypes);
|
(*gi)->Generate(fout, config, configurationTypes);
|
||||||
}
|
}
|
||||||
if (!this->Children.empty())
|
if (!this->Children.empty())
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "cmGeneratorExpression.h"
|
#include "cmGeneratorExpression.h"
|
||||||
#include "cmOutputConverter.h"
|
#include "cmOutputConverter.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
#include "cmTest.h"
|
#include "cmTest.h"
|
||||||
|
@ -27,6 +28,7 @@ cmTestGenerator
|
||||||
{
|
{
|
||||||
this->ActionsPerConfig = !test->GetOldStyle();
|
this->ActionsPerConfig = !test->GetOldStyle();
|
||||||
this->TestGenerated = false;
|
this->TestGenerated = false;
|
||||||
|
this->LG = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -35,6 +37,11 @@ cmTestGenerator
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmTestGenerator::Compute(cmLocalGenerator* lg)
|
||||||
|
{
|
||||||
|
this->LG = lg;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
|
void cmTestGenerator::GenerateScriptConfigs(std::ostream& os,
|
||||||
Indent const& indent)
|
Indent const& indent)
|
||||||
|
@ -81,8 +88,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
||||||
// Check whether the command executable is a target whose name is to
|
// Check whether the command executable is a target whose name is to
|
||||||
// be translated.
|
// be translated.
|
||||||
std::string exe = command[0];
|
std::string exe = command[0];
|
||||||
cmMakefile* mf = this->Test->GetMakefile();
|
cmGeneratorTarget* target =
|
||||||
cmGeneratorTarget* target = mf->FindGeneratorTargetToUse(exe);
|
this->LG->GetMakefile()->FindGeneratorTargetToUse(exe);
|
||||||
if(target && target->GetType() == cmTarget::EXECUTABLE)
|
if(target && target->GetType() == cmTarget::EXECUTABLE)
|
||||||
{
|
{
|
||||||
// Use the target file on disk.
|
// Use the target file on disk.
|
||||||
|
@ -110,7 +117,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Use the command name given.
|
// Use the command name given.
|
||||||
exe = ge.Parse(exe.c_str())->Evaluate(mf, config);
|
exe = ge.Parse(exe.c_str())->Evaluate(this->LG->GetMakefile(), config);
|
||||||
cmSystemTools::ConvertToUnixSlashes(exe);
|
cmSystemTools::ConvertToUnixSlashes(exe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +127,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
||||||
ci != command.end(); ++ci)
|
ci != command.end(); ++ci)
|
||||||
{
|
{
|
||||||
os << " " << cmOutputConverter::EscapeForCMake(
|
os << " " << cmOutputConverter::EscapeForCMake(
|
||||||
ge.Parse(*ci)->Evaluate(mf, config));
|
ge.Parse(*ci)->Evaluate(
|
||||||
|
this->LG->GetMakefile(), config));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish the test command.
|
// Finish the test command.
|
||||||
|
@ -137,7 +145,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
||||||
{
|
{
|
||||||
os << " " << i->first
|
os << " " << i->first
|
||||||
<< " " << cmOutputConverter::EscapeForCMake(
|
<< " " << cmOutputConverter::EscapeForCMake(
|
||||||
ge.Parse(i->second.GetValue())->Evaluate(mf, config));
|
ge.Parse(i->second.GetValue())->Evaluate(this->LG->GetMakefile(),
|
||||||
|
config));
|
||||||
}
|
}
|
||||||
os << ")" << std::endl;
|
os << ")" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "cmScriptGenerator.h"
|
#include "cmScriptGenerator.h"
|
||||||
|
|
||||||
class cmTest;
|
class cmTest;
|
||||||
|
class cmLocalGenerator;
|
||||||
|
|
||||||
/** \class cmTestGenerator
|
/** \class cmTestGenerator
|
||||||
* \brief Support class for generating install scripts.
|
* \brief Support class for generating install scripts.
|
||||||
|
@ -28,6 +29,8 @@ public:
|
||||||
configurations = std::vector<std::string>());
|
configurations = std::vector<std::string>());
|
||||||
virtual ~cmTestGenerator();
|
virtual ~cmTestGenerator();
|
||||||
|
|
||||||
|
void Compute(cmLocalGenerator* lg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
|
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
|
||||||
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
||||||
|
@ -38,6 +41,7 @@ protected:
|
||||||
virtual bool NeedsScriptNoConfig() const;
|
virtual bool NeedsScriptNoConfig() const;
|
||||||
void GenerateOldStyle(std::ostream& os, Indent const& indent);
|
void GenerateOldStyle(std::ostream& os, Indent const& indent);
|
||||||
|
|
||||||
|
cmLocalGenerator* LG;
|
||||||
cmTest* Test;
|
cmTest* Test;
|
||||||
bool TestGenerated;
|
bool TestGenerated;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue