diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 19 | ||||
-rw-r--r-- | Source/cmInstallDirectoryGenerator.cxx | 47 | ||||
-rw-r--r-- | Source/cmInstallDirectoryGenerator.h | 11 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 5 |
9 files changed, 84 insertions, 34 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 48573d8..b042c4a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 20150924) +set(CMake_VERSION_PATCH 20150925) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7aa8bb6..3589e82 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1091,6 +1091,18 @@ void cmGlobalGenerator::ClearEnabledLanguages() return this->CMakeInstance->GetState()->ClearEnabledLanguages(); } +void cmGlobalGenerator::CreateLocalGenerators() +{ + cmDeleteAll(this->LocalGenerators); + this->LocalGenerators.clear(); + this->LocalGenerators.reserve(this->Makefiles.size()); + for (std::vector<cmMakefile*>::const_iterator it = this->Makefiles.begin(); + it != this->Makefiles.end(); ++it) + { + this->LocalGenerators.push_back(this->CreateLocalGenerator(*it)); + } +} + void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; @@ -1099,8 +1111,6 @@ void cmGlobalGenerator::Configure() cmMakefile* dirMf = new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot()); this->Makefiles.push_back(dirMf); - cmLocalGenerator *lg = this->CreateLocalGenerator(dirMf); - this->LocalGenerators.push_back(lg); // set the Start directories dirMf->SetCurrentSourceDirectory @@ -1175,6 +1185,7 @@ void cmGlobalGenerator::Configure() void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes) { + this->CreateLocalGenerators(); cmDeleteAll(this->GeneratorTargets); this->GeneratorTargets.clear(); this->CreateGeneratorTargets(targetTypes); @@ -1246,11 +1257,6 @@ bool cmGlobalGenerator::Compute() unsigned int i; - for (i = 0; i < this->LocalGenerators.size(); ++i) - { - this->LocalGenerators[i]->ComputeObjectMaxPath(); - } - // Add generator specific helper commands for (i = 0; i < this->LocalGenerators.size(); ++i) { @@ -1936,12 +1942,6 @@ void cmGlobalGenerator::AddMakefile(cmMakefile *mf) this->CMakeInstance->UpdateProgress("Configuring", prog); } -//---------------------------------------------------------------------------- -void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) -{ - this->LocalGenerators.push_back(lg); -} - void cmGlobalGenerator::AddInstallComponent(const char* component) { if(component && *component) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 40f98dc..83cbc3f 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -186,7 +186,6 @@ public: {this->CurrentMakefile = mf;} void AddMakefile(cmMakefile *mf); - void AddLocalGenerator(cmLocalGenerator *lg); ///! Set an generator for an "external makefile based project" void SetExternalMakefileProjectGenerator( @@ -466,6 +465,8 @@ private: virtual void ForceLinkerLanguages(); + void CreateLocalGenerators(); + void CheckCompilerIdCompatibility(cmMakefile* mf, std::string const& lang) const; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index cf4fd69..0064713 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -578,23 +578,18 @@ void cmGlobalUnixMakefileGenerator3 if (!targetName.empty()) { cmMakefile* mf; - cmLocalUnixMakefileGenerator3 *lg; - if (!this->LocalGenerators.empty()) + if (!this->Makefiles.empty()) { - lg = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->LocalGenerators[0]); - mf = lg->GetMakefile(); + mf = this->Makefiles[0]; } else { cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); mf = new cmMakefile(this, snapshot); - lg = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->CreateLocalGenerator(mf)); // set the Start directories - lg->GetMakefile()->SetCurrentSourceDirectory + mf->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); - lg->GetMakefile()->SetCurrentBinaryDirectory + mf->SetCurrentBinaryDirectory (this->CMakeInstance->GetHomeOutputDirectory()); } @@ -603,12 +598,12 @@ void cmGlobalUnixMakefileGenerator3 { tname += "/fast"; } - tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT); + cmOutputConverter conv(mf->GetStateSnapshot()); + tname = conv.Convert(tname,cmOutputConverter::HOME_OUTPUT); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(tname); - if (this->LocalGenerators.empty()) + if (this->Makefiles.empty()) { - delete lg; delete mf; } } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 7593380..78cb5f0 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -12,6 +12,8 @@ #include "cmInstallDirectoryGenerator.h" #include "cmTarget.h" +#include "cmGeneratorExpression.h" +#include "cmLocalGenerator.h" //---------------------------------------------------------------------------- cmInstallDirectoryGenerator @@ -25,10 +27,16 @@ cmInstallDirectoryGenerator const char* literal_args, bool optional): cmInstallGenerator(dest, configurations, component, message), + LocalGenerator(0), Directories(dirs), FilePermissions(file_permissions), DirPermissions(dir_permissions), LiteralArguments(literal_args), Optional(optional) { + // We need per-config actions if destination have generator expressions. + if(cmGeneratorExpression::Find(Destination) != std::string::npos) + { + this->ActionsPerConfig = true; + } } //---------------------------------------------------------------------------- @@ -37,15 +45,43 @@ cmInstallDirectoryGenerator { } +void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) +{ + LocalGenerator = lg; +} + //---------------------------------------------------------------------------- void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, Indent const& indent) { + if(this->ActionsPerConfig) + { + this->cmInstallGenerator::GenerateScriptActions(os, indent); + } + else + { + this->AddDirectoryInstallRule(os, "", indent); + } +} + +void cmInstallDirectoryGenerator::GenerateScriptForConfig( + std::ostream& os, + const std::string& config, + Indent const& indent) +{ + this->AddDirectoryInstallRule(os, config, indent); +} + +void cmInstallDirectoryGenerator::AddDirectoryInstallRule( + std::ostream& os, + const std::string& config, + Indent const& indent) +{ // Write code to install the directories. const char* no_rename = 0; this->AddInstallRule(os, - this->Destination, + this->GetDestination(config), cmInstallType_DIRECTORY, this->Directories, this->Optional, @@ -54,3 +90,12 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, no_rename, this->LiteralArguments.c_str(), indent); } + +//---------------------------------------------------------------------------- +std::string +cmInstallDirectoryGenerator::GetDestination(std::string const& config) const +{ + cmGeneratorExpression ge; + return ge.Parse(this->Destination) + ->Evaluate(this->LocalGenerator->GetMakefile(), config); +} diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 165ab91..04107e1 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -31,8 +31,19 @@ public: bool optional = false); virtual ~cmInstallDirectoryGenerator(); + void Compute(cmLocalGenerator* lg); + + std::string GetDestination(std::string const& config) const; + protected: virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + virtual void GenerateScriptForConfig(std::ostream& os, + const std::string& config, + Indent const& indent); + void AddDirectoryInstallRule(std::ostream& os, + const std::string& config, + Indent const& indent); + cmLocalGenerator* LocalGenerator; std::vector<std::string> Directories; std::string FilePermissions; std::string DirPermissions; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6c7b194..f4de0f2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -54,6 +54,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; + + this->ComputeObjectMaxPath(); } cmLocalGenerator::~cmLocalGenerator() diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 771131f..6ea414a 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -300,7 +300,6 @@ public: void CreateEvaluationFileOutputs(const std::string& config); void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles); - void ComputeObjectMaxPath(); protected: ///! put all the libraries for a target on into the given stream void OutputLinkLibraries(std::string& linkLibraries, @@ -360,6 +359,8 @@ private: bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; void AddPositionIndependentFlags(std::string& flags, std::string const& l, int targetType); + + void ComputeObjectMaxPath(); }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8a3d197..6480667 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1756,11 +1756,6 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot); this->GetGlobalGenerator()->AddMakefile(subMf); - // create a new local generator and set its parent - cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->CreateLocalGenerator(subMf); - this->GetGlobalGenerator()->AddLocalGenerator(lg2); - // set the subdirs start dirs subMf->SetCurrentSourceDirectory(srcPath); subMf->SetCurrentBinaryDirectory(binPath); |