diff options
author | Brad King <brad.king@kitware.com> | 2015-08-24 14:06:56 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-08-24 14:06:56 (GMT) |
commit | 9135e3707d18b3fc37274acc3fca3b9352309a09 (patch) | |
tree | 6917f7d6332b30fb84d5a5ed3821e04b1ac75300 /Source | |
parent | aaf9532bbc2b45288de3350fa9379c10315c98d4 (diff) | |
parent | 1f39ee5bebf66aac33e7e1fa1172c048c13dfd2d (diff) | |
download | CMake-9135e3707d18b3fc37274acc3fca3b9352309a09.zip CMake-9135e3707d18b3fc37274acc3fca3b9352309a09.tar.gz CMake-9135e3707d18b3fc37274acc3fca3b9352309a09.tar.bz2 |
Merge topic 'generators-use-cmLocalGenerator'
1f39ee5b cmInstallExportGenerator: Require cmLocalGenerator, not cmMakefile.
c259b830 cmTestGenerator: Require cmLocalGenerator, not cmMakefile.
75e511ee cmInstallFilesGenerator: Require cmLocalGenerator, not cmMakefile.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExportInstallFileGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmInstallCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmInstallExportGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmInstallExportGenerator.h | 8 | ||||
-rw-r--r-- | Source/cmInstallFilesCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallFilesGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmInstallFilesGenerator.h | 9 | ||||
-rw-r--r-- | Source/cmInstallProgramsCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmTestGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmTestGenerator.h | 4 |
11 files changed, 53 insertions, 28 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index d55be11..7ffab0c 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -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)) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index f548f5d..333c2ff 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -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; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 7f6aa4d..97b9405 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -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()) diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 3e078f2..885ed05 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -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; diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 508c373..68557bd 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -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)); diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index ff2c6e5..c18b174 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -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); } diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index bf482d6..00b3a79 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -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; diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index be8096c..e6fbe88 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -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)); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a831d88..edb644d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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()) diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 1815ade..9d85f5a 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -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; } diff --git a/Source/cmTestGenerator.h b/Source/cmTestGenerator.h index 5446553..de8ab78 100644 --- a/Source/cmTestGenerator.h +++ b/Source/cmTestGenerator.h @@ -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; }; |