summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-09-21 12:53:42 (GMT)
committerBrad King <brad.king@kitware.com>2012-09-21 12:53:42 (GMT)
commita0a0877a1eb111d37ac4766a368206e73458489e (patch)
treedf5ed0dc179b7391972576c1c21ed70d87efbf22 /Source/cmLocalGenerator.cxx
parent33a60e6bd148479c63734286417f582444bf36b6 (diff)
downloadCMake-a0a0877a1eb111d37ac4766a368206e73458489e.zip
CMake-a0a0877a1eb111d37ac4766a368206e73458489e.tar.gz
CMake-a0a0877a1eb111d37ac4766a368206e73458489e.tar.bz2
OS X: Always generate -isysroot if any SDK is in use
Drop the last use of CMAKE_OSX_SYSROOT_DEFAULT. Replace internal platform variable CMAKE_${lang}_HAS_ISYSROOT with a more general CMAKE_${lang}_SYSROOT_FLAG variable. If the -isysroot flag exists and CMAKE_OSX_SYSROOT points to an SDK (not "/") then always add it to compiler command lines. This is already done in the Xcode IDE.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx46
1 files changed, 17 insertions, 29 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cf2af0a..f2bced4 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1792,46 +1792,34 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
{
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
- const char* sysroot =
- this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
- const char* sysrootDefault =
- this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
+ const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT");
+ if(sysroot && sysroot[0] == '/' && !sysroot[1])
+ { sysroot = 0; }
+ std::string sysrootFlagVar =
+ std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
+ const char* sysrootFlag =
+ this->Makefile->GetDefinition(sysrootFlagVar.c_str());
const char* deploymentTarget =
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
- std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT";
- bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str());
std::string deploymentTargetFlagVar =
std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
const char* deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str());
- bool flagsUsed = false;
- if(!archs.empty() && sysroot && lang && (lang[0] =='C' || lang[0] == 'F'))
- {
- // if there is more than one arch add the -arch and
- // -isysroot flags, or if there is one arch flag, but
- // it is not the default -arch flag for the system, then
- // add it. Otherwize do not add -arch and -isysroot
- if(archs[0] != "")
+ if(!archs.empty() && lang && (lang[0] =='C' || lang[0] == 'F'))
+ {
+ for(std::vector<std::string>::iterator i = archs.begin();
+ i != archs.end(); ++i)
{
- for( std::vector<std::string>::iterator i = archs.begin();
- i != archs.end(); ++i)
- {
- flags += " -arch ";
- flags += *i;
- }
- if(hasIsysroot)
- {
- flags += " -isysroot ";
- flags += sysroot;
- }
- flagsUsed = true;
+ flags += " -arch ";
+ flags += *i;
}
}
- if(!flagsUsed && sysroot && sysrootDefault &&
- strcmp(sysroot, sysrootDefault) != 0 && hasIsysroot)
+ if(sysrootFlag && *sysrootFlag && sysroot && *sysroot)
{
- flags += " -isysroot ";
+ flags += " ";
+ flags += sysrootFlag;
+ flags += " ";
flags += sysroot;
}