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
|
||||
// to reference if they are relative to the install prefix.
|
||||
std::string installPrefix =
|
||||
this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
|
||||
std::string installPrefix = this->IEGen->GetLocalGenerator()
|
||||
->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
|
||||
std::string const& expDest = this->IEGen->GetDestination();
|
||||
if(cmSystemTools::FileIsFullPath(expDest))
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator(
|
|||
{
|
||||
cmInstallGenerator::MessageLevel message =
|
||||
cmInstallGenerator::SelectMessageLevel(mf);
|
||||
return new cmInstallFilesGenerator(mf,
|
||||
return new cmInstallFilesGenerator(
|
||||
absFiles, args.GetDestination().c_str(),
|
||||
programs, args.GetPermissions().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.GetPermissions().c_str(), ica.GetConfigurations(),
|
||||
ica.GetComponent().c_str(), message, fname.c_str(),
|
||||
name_space.GetCString(), exportOld.IsEnabled(), this->Makefile);
|
||||
name_space.GetCString(), exportOld.IsEnabled());
|
||||
this->Makefile->AddInstallGenerator(exportGenerator);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -34,15 +34,14 @@ cmInstallExportGenerator::cmInstallExportGenerator(
|
|||
const char* component,
|
||||
MessageLevel message,
|
||||
const char* filename, const char* name_space,
|
||||
bool exportOld,
|
||||
cmMakefile* mf)
|
||||
bool exportOld)
|
||||
:cmInstallGenerator(destination, configurations, component, message)
|
||||
,ExportSet(exportSet)
|
||||
,FilePermissions(file_permissions)
|
||||
,FileName(filename)
|
||||
,Namespace(name_space)
|
||||
,ExportOld(exportOld)
|
||||
,Makefile(mf)
|
||||
,LocalGenerator(0)
|
||||
{
|
||||
this->EFGen = new cmExportInstallFileGenerator(this);
|
||||
exportSet->AddInstallation(this);
|
||||
|
@ -54,12 +53,18 @@ cmInstallExportGenerator::~cmInstallExportGenerator()
|
|||
delete this->EFGen;
|
||||
}
|
||||
|
||||
void cmInstallExportGenerator::Compute(cmLocalGenerator* lg)
|
||||
{
|
||||
this->LocalGenerator = lg;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmInstallExportGenerator::ComputeTempDir()
|
||||
{
|
||||
// Choose a temporary directory in which to generate the import
|
||||
// files to be installed.
|
||||
this->TempDir = this->Makefile->GetCurrentBinaryDirectory();
|
||||
this->TempDir =
|
||||
this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory();
|
||||
this->TempDir += cmake::GetCMakeFilesDirectory();
|
||||
this->TempDir += "/Export";
|
||||
if(this->Destination.empty())
|
||||
|
|
|
@ -32,12 +32,14 @@ public:
|
|||
const char* component,
|
||||
MessageLevel message,
|
||||
const char* filename, const char* name_space,
|
||||
bool exportOld, cmMakefile* mf);
|
||||
bool exportOld);
|
||||
~cmInstallExportGenerator();
|
||||
|
||||
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; }
|
||||
|
||||
|
@ -57,7 +59,7 @@ protected:
|
|||
std::string FileName;
|
||||
std::string Namespace;
|
||||
bool ExportOld;
|
||||
cmMakefile* Makefile;
|
||||
cmLocalGenerator* LocalGenerator;
|
||||
|
||||
std::string TempDir;
|
||||
std::string MainImportFile;
|
||||
|
|
|
@ -128,7 +128,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
|
|||
cmInstallGenerator::MessageLevel message =
|
||||
cmInstallGenerator::SelectMessageLevel(this->Makefile);
|
||||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallFilesGenerator(this->Makefile, this->Files,
|
||||
new cmInstallFilesGenerator(this->Files,
|
||||
destination.c_str(), false,
|
||||
no_permissions, no_configurations,
|
||||
no_component.c_str(), message, no_rename));
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
#include "cmGeneratorExpression.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmInstallFilesGenerator
|
||||
::cmInstallFilesGenerator(cmMakefile* mf,
|
||||
std::vector<std::string> const& files,
|
||||
::cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||
const char* dest, bool programs,
|
||||
const char* file_permissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
|
@ -27,7 +27,7 @@ cmInstallFilesGenerator
|
|||
const char* rename,
|
||||
bool optional):
|
||||
cmInstallGenerator(dest, configurations, component, message),
|
||||
Makefile(mf),
|
||||
LocalGenerator(0),
|
||||
Files(files),
|
||||
FilePermissions(file_permissions),
|
||||
Rename(rename),
|
||||
|
@ -51,6 +51,11 @@ cmInstallFilesGenerator
|
|||
{
|
||||
}
|
||||
|
||||
void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg)
|
||||
{
|
||||
this->LocalGenerator = lg;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmInstallFilesGenerator::AddFilesInstallRule(
|
||||
std::ostream& os, Indent const& indent,
|
||||
|
@ -94,8 +99,8 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
i != this->Files.end(); ++i)
|
||||
{
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
|
||||
cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config),
|
||||
files);
|
||||
cmSystemTools::ExpandListArgument(cge->Evaluate(
|
||||
this->LocalGenerator->GetMakefile(), config), files);
|
||||
}
|
||||
this->AddFilesInstallRule(os, indent, files);
|
||||
}
|
||||
|
|
|
@ -14,16 +14,13 @@
|
|||
|
||||
#include "cmInstallGenerator.h"
|
||||
|
||||
class cmMakefile;
|
||||
|
||||
/** \class cmInstallFilesGenerator
|
||||
* \brief Generate file installation rules.
|
||||
*/
|
||||
class cmInstallFilesGenerator: public cmInstallGenerator
|
||||
{
|
||||
public:
|
||||
cmInstallFilesGenerator(cmMakefile* mf,
|
||||
std::vector<std::string> const& files,
|
||||
cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||
const char* dest, bool programs,
|
||||
const char* file_permissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
|
@ -33,6 +30,8 @@ public:
|
|||
bool optional = false);
|
||||
virtual ~cmInstallFilesGenerator();
|
||||
|
||||
void Compute(cmLocalGenerator* lg);
|
||||
|
||||
protected:
|
||||
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
||||
virtual void GenerateScriptForConfig(std::ostream& os,
|
||||
|
@ -41,7 +40,7 @@ protected:
|
|||
void AddFilesInstallRule(std::ostream& os, Indent const& indent,
|
||||
std::vector<std::string> const& files);
|
||||
|
||||
cmMakefile* Makefile;
|
||||
cmLocalGenerator* LocalGenerator;
|
||||
std::vector<std::string> Files;
|
||||
std::string FilePermissions;
|
||||
std::string Rename;
|
||||
|
|
|
@ -91,7 +91,7 @@ void cmInstallProgramsCommand::FinalPass()
|
|||
cmInstallGenerator::MessageLevel message =
|
||||
cmInstallGenerator::SelectMessageLevel(this->Makefile);
|
||||
this->Makefile->AddInstallGenerator(
|
||||
new cmInstallFilesGenerator(this->Makefile, this->Files,
|
||||
new cmInstallFilesGenerator(this->Files,
|
||||
destination.c_str(), true,
|
||||
no_permissions, no_configurations,
|
||||
no_component.c_str(), message, no_rename));
|
||||
|
|
|
@ -196,6 +196,7 @@ void cmLocalGenerator::GenerateTestFiles()
|
|||
for(std::vector<cmTestGenerator*>::const_iterator gi = testers.begin();
|
||||
gi != testers.end(); ++gi)
|
||||
{
|
||||
(*gi)->Compute(this);
|
||||
(*gi)->Generate(fout, config, configurationTypes);
|
||||
}
|
||||
if (!this->Children.empty())
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "cmGeneratorExpression.h"
|
||||
#include "cmOutputConverter.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmTarget.h"
|
||||
#include "cmTest.h"
|
||||
|
@ -27,6 +28,7 @@ cmTestGenerator
|
|||
{
|
||||
this->ActionsPerConfig = !test->GetOldStyle();
|
||||
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,
|
||||
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
|
||||
// be translated.
|
||||
std::string exe = command[0];
|
||||
cmMakefile* mf = this->Test->GetMakefile();
|
||||
cmGeneratorTarget* target = mf->FindGeneratorTargetToUse(exe);
|
||||
cmGeneratorTarget* target =
|
||||
this->LG->GetMakefile()->FindGeneratorTargetToUse(exe);
|
||||
if(target && target->GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
// Use the target file on disk.
|
||||
|
@ -110,7 +117,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
else
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -120,7 +127,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
ci != command.end(); ++ci)
|
||||
{
|
||||
os << " " << cmOutputConverter::EscapeForCMake(
|
||||
ge.Parse(*ci)->Evaluate(mf, config));
|
||||
ge.Parse(*ci)->Evaluate(
|
||||
this->LG->GetMakefile(), config));
|
||||
}
|
||||
|
||||
// Finish the test command.
|
||||
|
@ -137,7 +145,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
{
|
||||
os << " " << i->first
|
||||
<< " " << cmOutputConverter::EscapeForCMake(
|
||||
ge.Parse(i->second.GetValue())->Evaluate(mf, config));
|
||||
ge.Parse(i->second.GetValue())->Evaluate(this->LG->GetMakefile(),
|
||||
config));
|
||||
}
|
||||
os << ")" << std::endl;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "cmScriptGenerator.h"
|
||||
|
||||
class cmTest;
|
||||
class cmLocalGenerator;
|
||||
|
||||
/** \class cmTestGenerator
|
||||
* \brief Support class for generating install scripts.
|
||||
|
@ -28,6 +29,8 @@ public:
|
|||
configurations = std::vector<std::string>());
|
||||
virtual ~cmTestGenerator();
|
||||
|
||||
void Compute(cmLocalGenerator* lg);
|
||||
|
||||
protected:
|
||||
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
|
||||
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
|
||||
|
@ -38,6 +41,7 @@ protected:
|
|||
virtual bool NeedsScriptNoConfig() const;
|
||||
void GenerateOldStyle(std::ostream& os, Indent const& indent);
|
||||
|
||||
cmLocalGenerator* LG;
|
||||
cmTest* Test;
|
||||
bool TestGenerated;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue