summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2c923dd..c2ec5f5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1789,6 +1789,26 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065(
return linkFlags;
}
+bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame(
+ const std::vector<std::string>& archs, const char* sysroot)
+{
+ if (!sysroot) {
+ return false;
+ }
+
+ for (std::string const& arch : archs) {
+ std::string const& archSysroot = this->AppleArchSysroots[arch];
+ if (cmIsOff(archSysroot)) {
+ continue;
+ }
+ if (archSysroot != sysroot) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget const* target,
const std::string& lang,
@@ -1814,7 +1834,8 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
std::string("CMAKE_") + lang + "_SYSROOT_FLAG";
const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar);
if (sysrootFlag && *sysrootFlag) {
- if (!this->AppleArchSysroots.empty()) {
+ if (!this->AppleArchSysroots.empty() &&
+ !this->AllAppleArchSysrootsAreTheSame(archs, sysroot)) {
for (std::string const& arch : archs) {
std::string const& archSysroot = this->AppleArchSysroots[arch];
if (cmIsOff(archSysroot)) {