diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-01-11 13:17:03 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-01-13 15:09:15 (GMT) |
commit | a7f393dc49e1b5f57d90075e0a9f7709d4a4ce90 (patch) | |
tree | cf4080f78d38a735e1c1579e3e4d9480903dd801 /Source/cmGlobalGenerator.cxx | |
parent | cb7af7af44bd9ce5ac11e345b1756ea0770bbc83 (diff) | |
download | CMake-a7f393dc49e1b5f57d90075e0a9f7709d4a4ce90.zip CMake-a7f393dc49e1b5f57d90075e0a9f7709d4a4ce90.tar.gz CMake-a7f393dc49e1b5f57d90075e0a9f7709d4a4ce90.tar.bz2 |
cmake: Future-proof --find-package mode.
Create cmGeneratorTargets before generating generate-time information.
C++ interfaces for querying build information is increasingly only
available at generate time through the cmGeneratorTarget class. Ensure
that the required cmGeneratorTarget instances are created. Use the
cmGlobalGenerator access API to access the relevant cmGeneratorTarget
instead of creating a temporary one on the stack.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index f883fbe..5a6b9b0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1375,35 +1375,37 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() } //---------------------------------------------------------------------------- +void cmGlobalGenerator::CreateGeneratorTargets(cmMakefile *mf) +{ + cmGeneratorTargetsType generatorTargets; + cmTargets& targets = mf->GetTargets(); + for(cmTargets::iterator ti = targets.begin(); + ti != targets.end(); ++ti) + { + cmTarget* t = &ti->second; + cmGeneratorTarget* gt = new cmGeneratorTarget(t); + this->GeneratorTargets[t] = gt; + generatorTargets[t] = gt; + } + + for(std::vector<cmTarget*>::const_iterator + j = mf->GetOwnedImportedTargets().begin(); + j != mf->GetOwnedImportedTargets().end(); ++j) + { + cmGeneratorTarget* gt = new cmGeneratorTarget(*j); + this->GeneratorTargets[*j] = gt; + generatorTargets[*j] = gt; + } + mf->SetGeneratorTargets(generatorTargets); +} + +//---------------------------------------------------------------------------- void cmGlobalGenerator::CreateGeneratorTargets() { // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - cmGeneratorTargetsType generatorTargets; - - cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); - - cmTargets& targets = mf->GetTargets(); - for(cmTargets::iterator ti = targets.begin(); - ti != targets.end(); ++ti) - { - cmTarget* t = &ti->second; - cmGeneratorTarget* gt = new cmGeneratorTarget(t); - this->GeneratorTargets[t] = gt; - generatorTargets[t] = gt; - } - - for(std::vector<cmTarget*>::const_iterator - j = mf->GetOwnedImportedTargets().begin(); - j != mf->GetOwnedImportedTargets().end(); ++j) - { - cmGeneratorTarget* gt = new cmGeneratorTarget(*j); - this->GeneratorTargets[*j] = gt; - generatorTargets[*j] = gt; - } - - mf->SetGeneratorTargets(generatorTargets); + this->CreateGeneratorTargets(this->LocalGenerators[i]->GetMakefile()); } } |