summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmFindCommon.cxx14
-rw-r--r--Source/cmFindCommon.h2
-rw-r--r--Source/cmLocalGenerator.cxx16
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx2
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx14
7 files changed, 33 insertions, 19 deletions
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index f4c0064..f352172 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -423,3 +423,17 @@ void cmFindCommon::AddTrailingSlashes(std::vector<std::string>& paths)
}
}
}
+
+//----------------------------------------------------------------------------
+void cmFindCommon::SetMakefile(cmMakefile* makefile)
+{
+ cmCommand::SetMakefile(makefile);
+
+ // If we are building for Apple (OSX or also iphone), make sure
+ // that frameworks and bundles are searched first.
+ if(this->Makefile->IsOn("APPLE"))
+ {
+ this->SearchFrameworkFirst = true;
+ this->SearchAppBundleFirst = true;
+ }
+}
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 08d2158..2ffbd00 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -61,6 +61,8 @@ protected:
PathType pathType);
void AddPathInternal(std::string const& in_path, PathType pathType);
+ void SetMakefile(cmMakefile* makefile);
+
bool NoDefaultPath;
bool NoCMakePath;
bool NoCMakeEnvironmentPath;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 851e34f..fd3508e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -712,9 +712,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
std::string langFlags;
this->AddLanguageFlags(langFlags, llang, 0);
-#ifdef __APPLE__
this->AddArchitectureFlags(langFlags, &target, llang, 0);
-#endif /* __APPLE__ */
vars.LanguageCompileFlags = langFlags.c_str();
cmCustomCommandLines commandLines;
@@ -1272,8 +1270,8 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
#endif
for(i = includes.begin(); i != includes.end(); ++i)
{
-#ifdef __APPLE__
- if(cmSystemTools::IsPathToFramework(i->c_str()))
+ if(this->Makefile->IsOn("APPLE")
+ && cmSystemTools::IsPathToFramework(i->c_str()))
{
std::string frameworkDir = *i;
frameworkDir += "/../";
@@ -1288,7 +1286,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
}
continue;
}
-#endif
+
std::string include = *i;
if(!flagUsed || repeatFlag)
{
@@ -1766,12 +1764,17 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout,
//----------------------------------------------------------------------------
-#ifdef __APPLE__
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmTarget* target,
const char *lang,
const char* config)
{
+ // Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
+ if(!this->Makefile->IsOn("APPLE"))
+ {
+ return;
+ }
+
if(this->EmitUniversalBinaryFlags)
{
std::vector<std::string> archs;
@@ -1828,7 +1831,6 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
}
}
}
-#endif /* __APPLE__ */
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index becdfff..4c2fc22 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -133,10 +133,8 @@ public:
std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; };
-#ifdef __APPLE__
void AddArchitectureFlags(std::string& flags, cmTarget* target,
const char *lang, const char* config);
-#endif /* __APPLE__ */
void AddLanguageFlags(std::string& flags, const char* lang,
const char* config);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index e7c4a7d..93c981a 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -229,10 +229,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Add language feature flags.
this->AddFeatureFlags(flags, linkLanguage);
-#ifdef __APPLE__
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
linkLanguage, this->ConfigName);
-#endif /* __APPLE__ */
// Add target-specific linker flags.
this->LocalGenerator->AppendFlags
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index f351174..d3e6e11 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -682,10 +682,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
std::string langFlags;
this->AddFeatureFlags(langFlags, linkLanguage);
-#ifdef __APPLE__
this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target,
linkLanguage, this->ConfigName);
-#endif /* __APPLE__ */
// remove any language flags that might not work with the
// particular os
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index dd45950..124d2bd 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -294,10 +294,8 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
// Add language feature flags.
this->AddFeatureFlags(flags, lang);
-#ifdef __APPLE__
this->LocalGenerator->AddArchitectureFlags(flags, this->Target,
lang, this->ConfigName);
-#endif /* __APPLE__ */
// Fortran-specific flags computed for this target.
if(*l == "Fortran")
@@ -1439,11 +1437,15 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
//----------------------------------------------------------------------------
std::string cmMakefileTargetGenerator::GetFrameworkFlags()
{
-#ifndef __APPLE__
- return std::string();
-#else
- std::set<cmStdString> emitted;
+ if(!this->Makefile->IsOn("APPLE"))
+ {
+ return std::string();
+ }
+
+ std::set<cmStdString> emitted;
+#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
emitted.insert("/System/Library/Frameworks");
+#else
std::vector<std::string> includes;
this->LocalGenerator->GetIncludeDirectories(includes);
std::vector<std::string>::iterator i;