cmake: Port find_package mode away from GetGeneratorTarget

This commit is contained in:
Stephen Kelly 2015-10-25 14:17:56 +01:00
parent 7a6caae1a7
commit b6278e9ff7
1 changed files with 7 additions and 4 deletions

View File

@ -447,8 +447,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
(cmSystemTools::GetCurrentWorkingDirectory()); (cmSystemTools::GetCurrentWorkingDirectory());
// read in the list file to fill the cache // read in the list file to fill the cache
snapshot.SetDefaultDefinitions(); snapshot.SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); cmMakefile* mf = new cmMakefile(gg, snapshot);
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get())); gg->AddMakefile(mf);
mf->SetArgcArgv(args); mf->SetArgcArgv(args);
@ -481,6 +481,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::vector<std::string> includeDirs; std::vector<std::string> includeDirs;
cmSystemTools::ExpandListArgument(includes, includeDirs); cmSystemTools::ExpandListArgument(includes, includeDirs);
gg->CreateGenerationObjects();
cmLocalGenerator* lg = gg->LocalGenerators[0];
std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language); std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, language);
std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS");
@ -510,8 +512,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath; std::string linkPath;
std::string flags; std::string flags;
std::string linkFlags; std::string linkFlags;
gg->CreateGeneratorTargets(cmGlobalGenerator::AllTargets, lg.get()); gg->CreateGenerationObjects();
cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); cmGeneratorTarget *gtgt = gg->FindGeneratorTarget(tgt->GetName());
cmLocalGenerator* lg = gtgt->GetLocalGenerator();
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
gtgt, false); gtgt, false);
linkLibs = frameworkPath + linkPath + linkLibs; linkLibs = frameworkPath + linkPath + linkLibs;