summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
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)
commit5a57cec2f4b7dce7616ae28d854b9d82a4cd5997 (patch)
treef11b84cb871e82c51454f26e8f63ab58108a0aa1 /Source/cmLocalGenerator.cxx
parenta9ea232e46acb0d12d6beaa018b45912c17bfdcd (diff)
parent3a7d1e9592af743a6bb538111e603d7f10666e0c (diff)
downloadCMake-5a57cec2f4b7dce7616ae28d854b9d82a4cd5997.zip
CMake-5a57cec2f4b7dce7616ae28d854b9d82a4cd5997.tar.gz
CMake-5a57cec2f4b7dce7616ae28d854b9d82a4cd5997.tar.bz2
Merge topic 'apple-merge-same-sysroot'
3a7d1e9592 Apple: Merge per-arch sysroot parameters if all are the same Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4647
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 22e5d32..829f9cc 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1880,6 +1880,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,
@@ -1908,7 +1928,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)) {