summaryrefslogtreecommitdiffstats
path: root/Source/cmCommonTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCommonTargetGenerator.cxx')
-rw-r--r--Source/cmCommonTargetGenerator.cxx73
1 files changed, 7 insertions, 66 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index a6f2a2e..b893dd3 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -159,8 +159,7 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags)
if (const char* modpath_flag =
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
std::vector<std::string> includes;
- const std::string& config =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+ const std::string& config = this->ConfigName;
this->LocalGenerator->GetIncludeDirectories(
includes, this->GeneratorTarget, "C", config);
for (std::vector<std::string>::const_iterator idi = includes.begin();
@@ -200,58 +199,6 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags(
}
}
-std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
-{
- 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;
-
- const std::string& config =
- this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
- 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;
- const char* cfg = this->LocalGenerator->GetConfigName().c_str();
- if (cmComputeLinkInformation* cli =
- this->GeneratorTarget->GetLinkInformation(cfg)) {
- 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);
@@ -280,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,
@@ -297,19 +246,11 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string& l)
ByLanguageMap::iterator i = this->DefinesByLanguage.find(l);
if (i == this->DefinesByLanguage.end()) {
std::set<std::string> defines;
- const char* lang = l.c_str();
- // Add the export symbol definition for shared library objects.
- if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) {
- this->LocalGenerator->AppendDefines(defines, exportMacro);
- }
-
- // Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AddCompileDefinitions(
- defines, this->GeneratorTarget, this->LocalGenerator->GetConfigName(),
- l);
+ this->LocalGenerator->GetTargetDefines(this->GeneratorTarget,
+ this->ConfigName, l, defines);
std::string definesString;
- this->LocalGenerator->JoinDefines(defines, definesString, lang);
+ this->LocalGenerator->JoinDefines(defines, definesString, l);
ByLanguageMap::value_type entry(l, definesString);
i = this->DefinesByLanguage.insert(entry).first;