cmLocalGenerator: Move GetFrameworkFlags implementation to private helper

This commit is contained in:
Tobias Hunger 2016-06-08 11:29:35 +02:00 committed by Brad King
parent 70d3bf8580
commit d9613b962e
1 changed files with 19 additions and 9 deletions

View File

@ -1271,16 +1271,19 @@ void cmLocalGenerator::GetTargetFlags(
} }
} }
std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, static std::string GetFrameworkFlags(const std::string& lang,
std::string const& config, const std::string& config,
cmGeneratorTarget* target) cmGeneratorTarget* target)
{ {
if (!this->Makefile->IsOn("APPLE")) { cmLocalGenerator* lg = target->GetLocalGenerator();
cmMakefile* mf = lg->GetMakefile();
if (!mf->IsOn("APPLE")) {
return std::string(); return std::string();
} }
std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; std::string fwSearchFlagVar = "CMAKE_" + lang + "_FRAMEWORK_SEARCH_FLAG";
const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar); const char* fwSearchFlag = mf->GetDefinition(fwSearchFlagVar);
if (!(fwSearchFlag && *fwSearchFlag)) { if (!(fwSearchFlag && *fwSearchFlag)) {
return std::string(); return std::string();
} }
@ -1291,12 +1294,12 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
#endif #endif
std::vector<std::string> includes; std::vector<std::string> includes;
this->GetIncludeDirectories(includes, target, "C", config); lg->GetIncludeDirectories(includes, target, "C", config);
// check all include directories for frameworks as this // check all include directories for frameworks as this
// will already have added a -F for the framework // will already have added a -F for the framework
for (std::vector<std::string>::iterator i = includes.begin(); for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) { i != includes.end(); ++i) {
if (this->GlobalGenerator->NameResolvesToFramework(*i)) { if (lg->GetGlobalGenerator()->NameResolvesToFramework(*i)) {
std::string frameworkDir = *i; std::string frameworkDir = *i;
frameworkDir += "/../"; frameworkDir += "/../";
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
@ -1311,7 +1314,7 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
i != frameworks.end(); ++i) { i != frameworks.end(); ++i) {
if (emitted.insert(*i).second) { if (emitted.insert(*i).second) {
flags += fwSearchFlag; flags += fwSearchFlag;
flags += this->ConvertToOutputFormat(*i, cmOutputConverter::SHELL); flags += lg->ConvertToOutputFormat(*i, cmOutputConverter::SHELL);
flags += " "; flags += " ";
} }
} }
@ -1319,6 +1322,13 @@ std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
return flags; return flags;
} }
std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l,
std::string const& config,
cmGeneratorTarget* target)
{
return ::GetFrameworkFlags(l, config, target);
}
std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib,
OutputFormat format) OutputFormat format)
{ {