summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-13 15:25:30 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-01-13 15:25:30 (GMT)
commitb003f56f8550614419f63c0c1530d7baa2871372 (patch)
treeb54c5f4cbab4c25c29f1cc89a382a5ffb029c2f1 /Source
parent0eadf2058cfc66fd281a3a0882e24f20d7b50277 (diff)
parenta7f393dc49e1b5f57d90075e0a9f7709d4a4ce90 (diff)
downloadCMake-b003f56f8550614419f63c0c1530d7baa2871372.zip
CMake-b003f56f8550614419f63c0c1530d7baa2871372.tar.gz
CMake-b003f56f8550614419f63c0c1530d7baa2871372.tar.bz2
Merge topic 'fix-find-package-mode'
a7f393dc cmake: Future-proof --find-package mode.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx50
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmake.cxx5
3 files changed, 31 insertions, 26 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());
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index fc5cab9..bbfe442 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -432,6 +432,8 @@ private:
// Per-target generator information.
cmGeneratorTargetsType GeneratorTargets;
+ friend class cmake;
+ void CreateGeneratorTargets(cmMakefile* mf);
void CreateGeneratorTargets();
void ComputeGeneratorTargetObjects();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1dd8a66..cf4b9c3 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -593,9 +593,10 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath;
std::string flags;
std::string linkFlags;
- cmGeneratorTarget gtgt(tgt);
+ gg->CreateGeneratorTargets(mf);
+ cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt);
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
- &gtgt);
+ gtgt);
linkLibs = frameworkPath + linkPath + linkLibs;
printf("%s\n", linkLibs.c_str() );