summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-15 13:32:03 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-10-15 13:32:03 (GMT)
commit08dc9720efff8cb3e11d615a4eda76286880bd01 (patch)
tree3f877c8f374dc51b41972d2cd19d7123cfdc34f3 /Source
parent77ade1e5a74f96d8a1ec088393c8fd6f74637ca6 (diff)
parent2e13c362117dbd0df2d5fff1c00ee8af2707185a (diff)
downloadCMake-08dc9720efff8cb3e11d615a4eda76286880bd01.zip
CMake-08dc9720efff8cb3e11d615a4eda76286880bd01.tar.gz
CMake-08dc9720efff8cb3e11d615a4eda76286880bd01.tar.bz2
Merge topic 'osx-framework-search-flag'
2e13c36 OS X: Encode -F framework search flag in per-language platform variable
Diffstat (limited to 'Source')
-rw-r--r--Source/cmDocumentVariables.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx32
-rw-r--r--Source/cmMakefileTargetGenerator.cxx14
-rw-r--r--Source/cmMakefileTargetGenerator.h2
4 files changed, 37 insertions, 13 deletions
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 58634ea..dbe1b04 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1977,6 +1977,8 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_FLAGS_RELWITHDEBINFO_INIT",
cmProperty::VARIABLE,0,0);
+ cm->DefineProperty("CMAKE_<LANG>_FRAMEWORK_SEARCH_FLAG",
+ cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_INFORMATION_LOADED",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS",
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 9174e26..3dde19f 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1253,6 +1253,12 @@ std::string cmLocalGenerator::GetIncludeFlags(
sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar.c_str());
}
+ std::string fwSearchFlagVar = "CMAKE_";
+ fwSearchFlagVar += lang;
+ fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag =
+ this->Makefile->GetDefinition(fwSearchFlagVar.c_str());
+
bool flagUsed = false;
std::set<cmStdString> emitted;
#ifdef __APPLE__
@@ -1261,7 +1267,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
std::vector<std::string>::const_iterator i;
for(i = includes.begin(); i != includes.end(); ++i)
{
- if(this->Makefile->IsOn("APPLE")
+ if(fwSearchFlag && *fwSearchFlag && this->Makefile->IsOn("APPLE")
&& cmSystemTools::IsPathToFramework(i->c_str()))
{
std::string frameworkDir = *i;
@@ -1271,8 +1277,8 @@ std::string cmLocalGenerator::GetIncludeFlags(
{
OutputFormat format = forResponseFile? RESPONSE : SHELL;
includeFlags
- << "-F" << this->Convert(frameworkDir.c_str(),
- START_OUTPUT, format, true)
+ << fwSearchFlag << this->Convert(frameworkDir.c_str(),
+ START_OUTPUT, format, true)
<< " ";
}
continue;
@@ -1770,13 +1776,21 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
}
// Append the framework search path flags.
- std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
- for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
- fdi != fwDirs.end(); ++fdi)
+ std::string fwSearchFlagVar = "CMAKE_";
+ fwSearchFlagVar += linkLanguage;
+ fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG";
+ const char* fwSearchFlag =
+ this->Makefile->GetDefinition(fwSearchFlagVar.c_str());
+ if(fwSearchFlag && *fwSearchFlag)
{
- frameworkPath += "-F";
- frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false);
- frameworkPath += " ";
+ std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths();
+ for(std::vector<std::string>::const_iterator fdi = fwDirs.begin();
+ fdi != fwDirs.end(); ++fdi)
+ {
+ frameworkPath += fwSearchFlag;
+ frameworkPath += this->Convert(fdi->c_str(), NONE, SHELL, false);
+ frameworkPath += " ";
+ }
}
// Append the library search path flags.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 42091e3..9ca9149 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -291,7 +291,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l)
// Add include directory flags.
this->LocalGenerator->
- AppendFlags(flags,this->GetFrameworkFlags().c_str());
+ AppendFlags(flags,this->GetFrameworkFlags(l).c_str());
// Add target-specific flags.
this->LocalGenerator->AddCompileOptions(flags, this->Target,
@@ -1518,13 +1518,21 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
}
//----------------------------------------------------------------------------
-std::string cmMakefileTargetGenerator::GetFrameworkFlags()
+std::string cmMakefileTargetGenerator::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.c_str());
+ if(!(fwSearchFlag && *fwSearchFlag))
+ {
+ return std::string();
+ }
+
std::set<cmStdString> emitted;
#ifdef __APPLE__ /* don't insert this when crosscompiling e.g. to iphone */
emitted.insert("/System/Library/Frameworks");
@@ -1559,7 +1567,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags()
{
if(emitted.insert(*i).second)
{
- flags += "-F";
+ flags += fwSearchFlag;
flags += this->Convert(i->c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL, true);
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index f7a1e2e..ec2af1c 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -124,7 +124,7 @@ protected:
void DriveCustomCommands(std::vector<std::string>& depends);
// Return the a string with -F flags on apple
- std::string GetFrameworkFlags();
+ std::string GetFrameworkFlags(std::string const& l);
void AppendFortranFormatFlags(std::string& flags, cmSourceFile& source);