diff options
author | Brad King <brad.king@kitware.com> | 2013-10-30 18:55:35 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-10-30 18:55:35 (GMT) |
commit | 8a6e82724c42920855c2348e914636f52a0c55d5 (patch) | |
tree | 9fc53980cac867f2ea8aaf94ee10a96364459ce4 /Source | |
parent | 6e900fbe6970981f8c73500581df99fa6b955fa1 (diff) | |
parent | 638843af984281c67edcc9ea9e05712ac9075d04 (diff) | |
download | CMake-8a6e82724c42920855c2348e914636f52a0c55d5.zip CMake-8a6e82724c42920855c2348e914636f52a0c55d5.tar.gz CMake-8a6e82724c42920855c2348e914636f52a0c55d5.tar.bz2 |
Merge topic 'use-generator-target'
638843a Remove the Location member from cmTarget.
90ef1cf Move GenerateTargetManifest to cmGeneratorTarget.
25f1df3 Split CreateGeneratorTargets into two methods.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 78 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 5 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 101 | ||||
-rw-r--r-- | Source/cmTarget.h | 4 |
7 files changed, 127 insertions, 95 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 511ae8a..6217955 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -25,8 +25,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = this->Makefile->GetLocalGenerator(); this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); - this->ClassifySources(); - this->LookupObjectLibraries(); } //---------------------------------------------------------------------------- @@ -324,3 +322,79 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories( { return this->Target->GetIncludeDirectories(config); } + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GenerateTargetManifest(const char* config) +{ + if (this->Target->IsImported()) + { + return; + } + cmMakefile* mf = this->Target->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); + cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + + // Get the names. + std::string name; + std::string soName; + std::string realName; + std::string impName; + std::string pdbName; + if(this->GetType() == cmTarget::EXECUTABLE) + { + this->Target->GetExecutableNames(name, realName, impName, pdbName, + config); + } + else if(this->GetType() == cmTarget::STATIC_LIBRARY || + this->GetType() == cmTarget::SHARED_LIBRARY || + this->GetType() == cmTarget::MODULE_LIBRARY) + { + this->Target->GetLibraryNames(name, soName, realName, impName, pdbName, + config); + } + else + { + return; + } + + // Get the directory. + std::string dir = this->Target->GetDirectory(config, false); + + // Add each name. + std::string f; + if(!name.empty()) + { + f = dir; + f += "/"; + f += name; + gg->AddToManifest(config? config:"", f); + } + if(!soName.empty()) + { + f = dir; + f += "/"; + f += soName; + gg->AddToManifest(config? config:"", f); + } + if(!realName.empty()) + { + f = dir; + f += "/"; + f += realName; + gg->AddToManifest(config? config:"", f); + } + if(!pdbName.empty()) + { + f = dir; + f += "/"; + f += pdbName; + gg->AddToManifest(config? config:"", f); + } + if(!impName.empty()) + { + f = this->Target->GetDirectory(config, true); + f += "/"; + f += impName; + gg->AddToManifest(config? config:"", f); + } +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index dedfa60..9723f72 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -74,10 +74,13 @@ public: bool IsSystemIncludeDirectory(const char *dir, const char *config); -private: + /** Add the target output files to the global generator manifest. */ + void GenerateTargetManifest(const char* config); + void ClassifySources(); void LookupObjectLibraries(); +private: std::map<std::string, std::vector<std::string> > SystemIncludesCache; cmGeneratorTarget(cmGeneratorTarget const&); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 465763d..8a8d61a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1128,6 +1128,9 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->AddHelperCommands(); } + // Create per-target generator information. + this->CreateGeneratorTargets(); + // Trace the dependencies, after that no custom commands should be added // because their dependencies might not be handled correctly for (i = 0; i < this->LocalGenerators.size(); ++i) @@ -1141,8 +1144,7 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->GenerateTargetManifest(); } - // Create per-target generator information. - this->CreateGeneratorTargets(); + this->ComputeGeneratorTargetObjects(); this->ProcessEvaluationFiles(); @@ -1336,7 +1338,6 @@ void cmGlobalGenerator::CreateGeneratorTargets() cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; - this->ComputeTargetObjects(gt); generatorTargets[t] = gt; } @@ -1354,6 +1355,25 @@ void cmGlobalGenerator::CreateGeneratorTargets() } //---------------------------------------------------------------------------- +void cmGlobalGenerator::ComputeGeneratorTargetObjects() +{ + // Construct per-target generator information. + for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) + { + cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + cmGeneratorTargetsType targets = mf->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + cmGeneratorTarget* gt = ti->second; + gt->ClassifySources(); + gt->LookupObjectLibraries(); + this->ComputeTargetObjects(gt); + } + } +} + +//---------------------------------------------------------------------------- void cmGlobalGenerator::ClearGeneratorTargets() { for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 1538cb5..df434b3 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -408,6 +408,7 @@ private: // Per-target generator information. cmGeneratorTargetsType GeneratorTargets; void CreateGeneratorTargets(); + void ComputeGeneratorTargetObjects(); void ClearGeneratorTargets(); virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index edf80e6..2a29061 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -530,10 +530,11 @@ void cmLocalGenerator::GenerateTargetManifest() this->Makefile->GetConfigurations(configNames); // Add our targets to the manifest for each configuration. - cmTargets& targets = this->Makefile->GetTargets(); - for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) + cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator t = targets.begin(); + t != targets.end(); ++t) { - cmTarget& target = t->second; + cmGeneratorTarget& target = *t->second; if(configNames.empty()) { target.GenerateTargetManifest(0); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 59c407b..6d6d2d8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2725,27 +2725,34 @@ const char* cmTarget::GetLocation(const char* config) //---------------------------------------------------------------------------- const char* cmTarget::ImportedGetLocation(const char* config) { - this->Location = this->ImportedGetFullPath(config, false); - return this->Location.c_str(); + static std::string location; + location = this->ImportedGetFullPath(config, false); + return location.c_str(); } //---------------------------------------------------------------------------- const char* cmTarget::NormalGetLocation(const char* config) { + static std::string location; // Handle the configuration-specific case first. if(config) { - this->Location = this->GetFullPath(config, false); - return this->Location.c_str(); + location = this->GetFullPath(config, false); + return location.c_str(); } // Now handle the deprecated build-time configuration location. - this->Location = this->GetDirectory(); + location = this->GetDirectory(); + if(!location.empty()) + { + location += "/"; + } const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR"); if(cfgid && strcmp(cfgid, ".") != 0) { - this->Location += "/"; - this->Location += cfgid; + location += "/"; + location += cfgid; + location += "/"; } if(this->IsAppBundleOnApple()) @@ -2753,13 +2760,13 @@ const char* cmTarget::NormalGetLocation(const char* config) std::string macdir = this->BuildMacContentDirectory("", config, false); if(!macdir.empty()) { - this->Location += "/"; - this->Location += macdir; + location += "/"; + location += macdir; } } - this->Location += "/"; - this->Location += this->GetFullName(config, false); - return this->Location.c_str(); + location += "/"; + location += this->GetFullName(config, false); + return location.c_str(); } //---------------------------------------------------------------------------- @@ -3917,76 +3924,6 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, } //---------------------------------------------------------------------------- -void cmTarget::GenerateTargetManifest(const char* config) -{ - cmMakefile* mf = this->Makefile; - cmLocalGenerator* lg = mf->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); - - // Get the names. - std::string name; - std::string soName; - std::string realName; - std::string impName; - std::string pdbName; - if(this->GetType() == cmTarget::EXECUTABLE) - { - this->GetExecutableNames(name, realName, impName, pdbName, config); - } - else if(this->GetType() == cmTarget::STATIC_LIBRARY || - this->GetType() == cmTarget::SHARED_LIBRARY || - this->GetType() == cmTarget::MODULE_LIBRARY) - { - this->GetLibraryNames(name, soName, realName, impName, pdbName, config); - } - else - { - return; - } - - // Get the directory. - std::string dir = this->GetDirectory(config, false); - - // Add each name. - std::string f; - if(!name.empty()) - { - f = dir; - f += "/"; - f += name; - gg->AddToManifest(config? config:"", f); - } - if(!soName.empty()) - { - f = dir; - f += "/"; - f += soName; - gg->AddToManifest(config? config:"", f); - } - if(!realName.empty()) - { - f = dir; - f += "/"; - f += realName; - gg->AddToManifest(config? config:"", f); - } - if(!pdbName.empty()) - { - f = this->GetPDBDirectory(config); - f += "/"; - f += pdbName; - gg->AddToManifest(config? config:"", f); - } - if(!impName.empty()) - { - f = this->GetDirectory(config, true); - f += "/"; - f += impName; - gg->AddToManifest(config? config:"", f); - } -} - -//---------------------------------------------------------------------------- void cmTarget::SetPropertyDefault(const char* property, const char* default_value) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9d62f5f..41af8ab 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -410,9 +410,6 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0); - /** Add the target output files to the global generator manifest. */ - void GenerateTargetManifest(const char* config); - /** * Compute whether this target must be relinked before installing. */ @@ -677,7 +674,6 @@ private: bool HaveInstallRule; std::string InstallPath; std::string RuntimeInstallPath; - std::string Location; std::string ExportMacro; std::set<cmStdString> Utilities; bool RecordDependencies; |