summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-22 12:31:42 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-22 12:32:02 (GMT)
commit8c00f5ef0a29758c56fa46a11e150b0e0f5c364e (patch)
tree7a5bf984180e312b2cc57a4b1d18087019134871
parentc4ccf23186bce46824655358c2786134a754e6f1 (diff)
parent3a7d1e9592af743a6bb538111e603d7f10666e0c (diff)
downloadCMake-8c00f5ef0a29758c56fa46a11e150b0e0f5c364e.zip
CMake-8c00f5ef0a29758c56fa46a11e150b0e0f5c364e.tar.gz
CMake-8c00f5ef0a29758c56fa46a11e150b0e0f5c364e.tar.bz2
Merge topic 'apple-merge-same-sysroot' into release-3.17
3a7d1e9592 Apple: Merge per-arch sysroot parameters if all are the same Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4647
-rw-r--r--Source/cmLocalGenerator.cxx23
-rw-r--r--Source/cmLocalGenerator.h2
2 files changed, 24 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)) {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 5377be9..a459384 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -528,6 +528,8 @@ private:
int targetType);
void ComputeObjectMaxPath();
+ bool AllAppleArchSysrootsAreTheSame(const std::vector<std::string>& archs,
+ const char* sysroot);
};
#if !defined(CMAKE_BOOTSTRAP)