summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-07-26 12:45:56 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-12-13 15:35:38 (GMT)
commita9b41195d292cfd0686b6c1f4d22f654728dca0b (patch)
tree4e9d37ef3f1738b54525538d083902b9d1821b71 /Source/cmLocalGenerator.cxx
parent372c89ea38dd56457f93c688f1e8bf30a25bad57 (diff)
downloadCMake-a9b41195d292cfd0686b6c1f4d22f654728dca0b.zip
CMake-a9b41195d292cfd0686b6c1f4d22f654728dca0b.tar.gz
CMake-a9b41195d292cfd0686b6c1f4d22f654728dca0b.tar.bz2
Handle multi-arch sysroots on Apple platforms
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx31
1 files changed, 24 insertions, 7 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 187e273..303009e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1771,7 +1771,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
const std::string& lang,
const std::string& config)
{
- // Only add macOS specific flags on Darwin platforms (macOS and iOS):
+ // Only add Apple specific flags on Apple platforms
if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) {
std::vector<std::string> archs;
target->GetAppleArchs(config, archs);
@@ -1790,11 +1790,29 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::string sysrootFlagVar =
std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar);
- if (sysrootFlag && *sysrootFlag && sysroot && *sysroot) {
- flags += " ";
- flags += sysrootFlag;
- flags += " ";
- flags += this->ConvertToOutputFormat(sysroot, SHELL);
+ if (sysrootFlag && *sysrootFlag) {
+ std::vector<std::string> arch_sysroots;
+ if (const char* arch_sysroots_str =
+ this->Makefile->GetDefinition("CMAKE_APPLE_ARCH_SYSROOTS")) {
+ cmExpandList(std::string(arch_sysroots_str), arch_sysroots, true);
+ }
+ if (!arch_sysroots.empty()) {
+ assert(arch_sysroots.size() == archs.size());
+ for (size_t i = 0; i < archs.size(); ++i) {
+ if (arch_sysroots[i].empty()) {
+ continue;
+ }
+ flags += " -Xarch_" + archs[i] + " ";
+ // Combine sysroot flag and path to work with -Xarch
+ std::string arch_sysroot = sysrootFlag + arch_sysroots[i];
+ flags += this->ConvertToOutputFormat(arch_sysroot, SHELL);
+ }
+ } else if (sysroot && *sysroot) {
+ flags += " ";
+ flags += sysrootFlag;
+ flags += " ";
+ flags += this->ConvertToOutputFormat(sysroot, SHELL);
+ }
}
const char* deploymentTarget =
@@ -1803,7 +1821,6 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG";
const char* deploymentTargetFlag =
this->Makefile->GetDefinition(deploymentTargetFlagVar);
-
if (deploymentTargetFlag && *deploymentTargetFlag && deploymentTarget &&
*deploymentTarget) {
flags += " ";