diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2016-06-08 09:29:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-06-09 14:39:57 (GMT) |
commit | 70d3bf85808d17dba8ec90e2975f2741383ef260 (patch) | |
tree | a4b4ad0543a85543016956eb290468855feeb784 /Source | |
parent | de4ee088e7ab60213b551ecf98bc9e1b512ee393 (diff) | |
download | CMake-70d3bf85808d17dba8ec90e2975f2741383ef260.zip CMake-70d3bf85808d17dba8ec90e2975f2741383ef260.tar.gz CMake-70d3bf85808d17dba8ec90e2975f2741383ef260.tar.bz2 |
cmLocalGenerator: Adopt GetFrameworkFlags method
Move it from cmCommonTargetGenerator.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 54 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 48 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 |
4 files changed, 55 insertions, 54 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index cb62bde..131b490 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -199,56 +199,6 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags( } } -std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l) -{ - std::string const& config = this->ConfigName; - if (!this->Makefile->IsOn("APPLE")) { - return std::string(); - } - - std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; - const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar); - if (!(fwSearchFlag && *fwSearchFlag)) { - return std::string(); - } - - std::set<std::string> emitted; -#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ - emitted.insert("/System/Library/Frameworks"); -#endif - std::vector<std::string> includes; - - this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, - "C", config); - // check all include directories for frameworks as this - // will already have added a -F for the framework - for (std::vector<std::string>::iterator i = includes.begin(); - i != includes.end(); ++i) { - if (this->GlobalGenerator->NameResolvesToFramework(*i)) { - std::string frameworkDir = *i; - frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); - emitted.insert(frameworkDir); - } - } - - std::string flags; - if (cmComputeLinkInformation* cli = - this->GeneratorTarget->GetLinkInformation(config)) { - std::vector<std::string> const& frameworks = cli->GetFrameworkPaths(); - for (std::vector<std::string>::const_iterator i = frameworks.begin(); - i != frameworks.end(); ++i) { - if (emitted.insert(*i).second) { - flags += fwSearchFlag; - flags += this->LocalGenerator->ConvertToOutputFormat( - *i, cmOutputConverter::SHELL); - flags += " "; - } - } - } - return flags; -} - std::string cmCommonTargetGenerator::GetFlags(const std::string& l) { ByLanguageMap::iterator i = this->FlagsByLanguage.find(l); @@ -277,7 +227,9 @@ std::string cmCommonTargetGenerator::GetFlags(const std::string& l) this->LocalGenerator->AppendFlags(flags, this->Makefile->GetDefineFlags()); // Add framework directory flags. - this->LocalGenerator->AppendFlags(flags, this->GetFrameworkFlags(l)); + this->LocalGenerator->AppendFlags( + flags, this->LocalGenerator->GetFrameworkFlags(l, this->ConfigName, + this->GeneratorTarget)); // Add target-specific flags. this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang, diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index c9645e7..ace5351 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -71,9 +71,6 @@ protected: void AppendFortranFormatFlags(std::string& flags, cmSourceFile const& source); - // Return the a string with -F flags on apple - std::string GetFrameworkFlags(std::string const& l); - virtual void AddIncludeFlags(std::string& flags, std::string const& lang) = 0; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b369420..9c503c2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1271,6 +1271,54 @@ void cmLocalGenerator::GetTargetFlags( } } +std::string cmLocalGenerator::GetFrameworkFlags(std::string const& l, + std::string const& config, + cmGeneratorTarget* target) +{ + if (!this->Makefile->IsOn("APPLE")) { + return std::string(); + } + + std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; + const char* fwSearchFlag = this->Makefile->GetDefinition(fwSearchFlagVar); + if (!(fwSearchFlag && *fwSearchFlag)) { + return std::string(); + } + + std::set<std::string> emitted; +#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */ + emitted.insert("/System/Library/Frameworks"); +#endif + std::vector<std::string> includes; + + this->GetIncludeDirectories(includes, target, "C", config); + // check all include directories for frameworks as this + // will already have added a -F for the framework + for (std::vector<std::string>::iterator i = includes.begin(); + i != includes.end(); ++i) { + if (this->GlobalGenerator->NameResolvesToFramework(*i)) { + std::string frameworkDir = *i; + frameworkDir += "/../"; + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); + emitted.insert(frameworkDir); + } + } + + std::string flags; + if (cmComputeLinkInformation* cli = target->GetLinkInformation(config)) { + std::vector<std::string> const& frameworks = cli->GetFrameworkPaths(); + for (std::vector<std::string>::const_iterator i = frameworks.begin(); + i != frameworks.end(); ++i) { + if (emitted.insert(*i).second) { + flags += fwSearchFlag; + flags += this->ConvertToOutputFormat(*i, cmOutputConverter::SHELL); + flags += " "; + } + } + } + return flags; +} + std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 5ced648..ac2ebce 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -313,6 +313,10 @@ public: std::string& frameworkPath, std::string& linkPath, cmGeneratorTarget* target, bool useWatcomQuote); + std::string GetFrameworkFlags(std::string const& l, + std::string const& config, + cmGeneratorTarget* target); + virtual void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt = 0); |