Merge topic 'generators-use-cmLocalGenerator'
1f39ee5b
cmInstallExportGenerator: Require cmLocalGenerator, not cmMakefile.c259b830
cmTestGenerator: Require cmLocalGenerator, not cmMakefile.75e511ee
cmInstallFilesGenerator: Require cmLocalGenerator, not cmMakefile.
This commit is contained in:
commit
9135e3707d
|
@ -72,8 +72,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
|
||||||
|
|
||||||
// Set an _IMPORT_PREFIX variable for import location properties
|
// Set an _IMPORT_PREFIX variable for import location properties
|
||||||
// to reference if they are relative to the install prefix.
|
// to reference if they are relative to the install prefix.
|
||||||
std::string installPrefix =
|
std::string installPrefix = this->IEGen->GetLocalGenerator()
|
||||||
this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
|
->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
|
||||||
std::string const& expDest = this->IEGen->GetDestination();
|
std::string const& expDest = this->IEGen->GetDestination();
|
||||||
if(cmSystemTools::FileIsFullPath(expDest))
|
if(cmSystemTools::FileIsFullPath(expDest))
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator(
|
||||||
{
|
{
|
||||||
cmInstallGenerator::MessageLevel message =
|
cmInstallGenerator::MessageLevel message =
|
||||||
cmInstallGenerator::SelectMessageLevel(mf);
|
cmInstallGenerator::SelectMessageLevel(mf);
|
||||||
return new cmInstallFilesGenerator(mf,
|
return new cmInstallFilesGenerator(
|
||||||
absFiles, args.GetDestination().c_str(),
|
absFiles, args.GetDestination().c_str(),
|
||||||
programs, args.GetPermissions().c_str(),
|
programs, args.GetPermissions().c_str(),
|
||||||
args.GetConfigurations(), args.GetComponent().c_str(),
|
args.GetConfigurations(), args.GetComponent().c_str(),
|
||||||
|
@ -1406,7 +1406,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
|
||||||
ica.GetDestination().c_str(),
|
ica.GetDestination().c_str(),
|
||||||
ica.GetPermissions().c_str(), ica.GetConfigurations(),
|
ica.GetPermissions().c_str(), ica.GetConfigurations(),
|
||||||
ica.GetComponent().c_str(), message, fname.c_str(),
|
ica.GetComponent().c_str(), message, fname.c_str(),
|
||||||
name_space.GetCString(), exportOld.IsEnabled(), this->Makefile);
|
name_space.GetCString(), exportOld.IsEnabled());
|
||||||
this->Makefile->AddInstallGenerator(exportGenerator);
|
this->Makefile->AddInstallGenerator(exportGenerator);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -34,15 +34,14 @@ cmInstallExportGenerator::cmInstallExportGenerator(
|
||||||
const char* component,
|
const char* component,
|
||||||
MessageLevel message,
|
MessageLevel message,
|
||||||
const char* filename, const char* name_space,
|
const char* filename, const char* name_space,
|
||||||
bool exportOld,
|
bool exportOld)
|
||||||
cmMakefile* mf)
|
|
||||||
:cmInstallGenerator(destination, configurations, component, message)
|
:cmInstallGenerator(destination, configurations, component, message)
|
||||||
,ExportSet(exportSet)
|
,ExportSet(exportSet)
|
||||||
,FilePermissions(file_permissions)
|
,FilePermissions(file_permissions)
|
||||||
,FileName(filename)
|
,FileName(filename)
|
||||||
,Namespace(name_space)
|
,Namespace(name_space)
|
||||||
,ExportOld(exportOld)
|
,ExportOld(exportOld)
|
||||||
,Makefile(mf)
|
,LocalGenerator(0)
|
||||||
{
|
{
|
||||||
this->EFGen = new cmExportInstallFileGenerator(this);
|
this->EFGen = new cmExportInstallFileGenerator(this);
|
||||||
exportSet->AddInstallation(this);
|
exportSet->AddInstallation(this);
|
||||||
|
@ -54,12 +53,18 @@ cmInstallExportGenerator::~cmInstallExportGenerator()
|
||||||
delete this->EFGen;
|
delete this->EFGen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmInstallExportGenerator::Compute(cmLocalGenerator* lg)
|
||||||
|
{
|
||||||
|
this->LocalGenerator = lg;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmInstallExportGenerator::ComputeTempDir()
|
void cmInstallExportGenerator::ComputeTempDir()
|
||||||
{
|
{
|
||||||
// Choose a temporary directory in which to generate the import
|
// Choose a temporary directory in which to generate the import
|
||||||
// files to be installed.
|
// files to be installed.
|
||||||
this->TempDir = this->Makefile->GetCurrentBinaryDirectory();
|
this->TempDir =
|
||||||
|
this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory();
|
||||||
this->TempDir += cmake::GetCMakeFilesDirectory();
|
this->TempDir += cmake::GetCMakeFilesDirectory();
|
||||||
this->TempDir += "/Export";
|
this->TempDir += "/Export";
|
||||||
if(this->Destination.empty())
|
if(this->Destination.empty())
|
||||||
|
|
|
@ -32,12 +32,14 @@ public:
|
||||||
const char* component,
|
const char* component,
|
||||||
MessageLevel message,
|
MessageLevel message,
|
||||||
const char* filename, const char* name_space,
|
const char* filename, const char* name_space,
|
||||||
bool exportOld, cmMakefile* mf);
|
bool exportOld);
|
||||||
~cmInstallExportGenerator();
|
~cmInstallExportGenerator();
|
||||||
|
|
||||||
cmExportSet* GetExportSet() {return this->ExportSet;}
|
cmExportSet* GetExportSet() {return this->ExportSet;}
|
||||||
|
|
||||||
cmMakefile* GetMakefile() const { return this->Makefile; }
|
void Compute(cmLocalGenerator* lg);
|
||||||
|
|
||||||
|
cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; }
|
||||||
|
|
||||||
const std::string& GetNamespace() const { return this->Namespace; }
|
const std::string& GetNamespace() const { return this->Namespace; }
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ protected:
|
||||||
std::string FileName;
|
std::string FileName;
|
||||||
std::string Namespace;
|
std::string Namespace;
|
||||||
bool ExportOld;
|
bool ExportOld;
|
||||||
cmMakefile* Makefile;
|
cmLocalGenerator* LocalGenerator;
|
||||||
|
|
||||||
std::string TempDir;
|
std::string TempDir;
|
||||||
std::string MainImportFile;
|
std::string MainImportFile;
|
||||||
|
|
|
@ -128,7 +128,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
|
||||||
cmInstallGenerator::MessageLevel message =
|
cmInstallGenerator::MessageLevel message =
|
||||||
cmInstallGenerator::SelectMessageLevel(this->Makefile);
|
cmInstallGenerator::SelectMessageLevel(this->Makefile);
|
||||||
this->Makefile->AddInstallGenerator(
|
this->Makefile->AddInstallGenerator(
|
||||||
new cmInstallFilesGenerator(this->Makefile, this->Files,
|
new cmInstallFilesGenerator(this->Files,
|
||||||
destination.c_str(), false,
|
destination.c_str(), false,
|
||||||
no_permissions, no_configurations,
|
no_permissions, no_configurations,
|
||||||
no_component.c_str(), message, no_rename));
|
no_component.c_str(), message, no_rename));
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
#include "cmGeneratorExpression.h"
|
#include "cmGeneratorExpression.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
#include "cmLocalGenerator.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
cmInstallFilesGenerator
|
cmInstallFilesGenerator
|
||||||
::cmInstallFilesGenerator(cmMakefile* mf,
|
::cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||||
std::vector<std::string> const& files,
|
|
||||||
const char* dest, bool programs,
|
const char* dest, bool programs,
|
||||||
const char* file_permissions,
|
const char* file_permissions,
|
||||||
std::vector<std::string> const& configurations,
|
std::vector<std::string> const& configurations,
|
||||||
|
@ -27,7 +27,7 @@ cmInstallFilesGenerator
|
||||||
const char* rename,
|
const char* rename,
|
||||||
bool optional):
|
bool optional):
|
||||||
cmInstallGenerator(dest, configurations, component, message),
|
cmInstallGenerator(dest, configurations, component, message),
|
||||||
Makefile(mf),
|
LocalGenerator(0),
|
||||||
Files(files),
|
Files(files),
|
||||||
FilePermissions(file_permissions),
|
FilePermissions(file_permissions),
|
||||||
Rename(rename),
|
Rename(rename),
|
||||||
|
@ -51,6 +51,11 @@ cmInstallFilesGenerator
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg)
|
||||||
|
{
|
||||||
|
this->LocalGenerator = lg;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmInstallFilesGenerator::AddFilesInstallRule(
|
void cmInstallFilesGenerator::AddFilesInstallRule(
|
||||||
std::ostream& os, Indent const& indent,
|
std::ostream& os, Indent const& indent,
|
||||||
|
@ -94,8 +99,8 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
|
||||||
i != this->Files.end(); ++i)
|
i != this->Files.end(); ++i)
|
||||||
{
|
{
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
|
||||||
cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config),
|
cmSystemTools::ExpandListArgument(cge->Evaluate(
|
||||||
files);
|
this->LocalGenerator->GetMakefile(), config), files);
|
||||||
}
|
}
|
||||||
this->AddFilesInstallRule(os, indent, files);
|
this->AddFilesInstallRule(os, indent, files);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,13 @@
|
||||||
|
|
||||||
#include "cmInstallGenerator.h"
|
#include "cmInstallGenerator.h"
|
||||||
|
|
||||||
class cmMakefile;
|
|
||||||
|
|
||||||
/** \class cmInstallFilesGenerator
|
/** \class cmInstallFilesGenerator
|
||||||
* \brief Generate file installation rules.
|
* \brief Generate file installation rules.
|
||||||
*/
|
*/
|
||||||
class cmInstallFilesGenerator: public cmInstallGenerator
|
class cmInstallFilesGenerator: public cmInstallGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmInstallFilesGenerator(cmMakefile* mf,
|
cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||||
std::vector<std::string> const& files,
|
|
||||||
const char* dest, bool programs,
|
const char* dest, bool programs,
|
||||||
const char* file_permissions,
|
const char* file_permissions,
|
||||||
std::vector<std::string> const& configurations,
|
std::vector<std::string> const& configurations,
|
||||||
|
@ -33,6 +30,8 @@ public:
|
||||||
bool optional = false);
|
bool optional = false);
|
||||||
virtual ~cmInstallFilesGenerator();
|
virtual ~cmInstallFilesGenerator();
|
||||||
|
|
||||||
|
void Compute(cmLocalGenerator* lg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
||||||
virtual void GenerateScriptForConfig(std::ostream& os,
|
virtual void GenerateScriptForConfig(std::ostream& os,
|
||||||
|
@ -41,7 +40,7 @@ protected:
|
||||||
void AddFilesInstallRule(std::ostream& os, Indent const& indent,
|
void AddFilesInstallRule(std::ostream& os, Indent const& indent,
|
||||||
std::vector<std::string> const& files);
|
std::vector<std::string> const& files);
|
||||||
|
|
||||||
cmMakefile* Makefile;
|
cmLocalGenerator* LocalGenerator;
|
||||||
std::vector<std::string> Files;
|
std::vector<std::string> Files;
|
||||||
std::string FilePermissions;
|
std::string FilePermissions;
|
||||||
std::string Rename;
|
std::string Rename;
|
||||||
|
|
|
@ -91,7 +91,7 @@ void cmInstallProgramsCommand::FinalPass()
|
||||||
cmInstallGenerator::MessageLevel message =
|
cmInstallGenerator::MessageLevel message =
|
||||||
cmInstallGenerator::SelectMessageLevel(this->Makefile);
|
cmInstallGenerator::SelectMessageLevel(this->Makefile);
|
||||||
this->Makefile->AddInstallGenerator(
|
this->Makefile->AddInstallGenerator(
|
||||||
new cmInstallFilesGenerator(this->Makefile, this->Files,
|
new cmInstallFilesGenerator(this->Files,
|
||||||
destination.c_str(), true,
|
destination.c_str(), true,
|
||||||
no_permissions, no_configurations,
|
no_permissions, no_configurations,
|
||||||
no_component.c_str(), message, no_rename));
|
no_component.c_str(), message, no_rename));
|
||||||
|
|
|
@ -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