summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-11-12 14:43:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-11-12 14:43:11 (GMT)
commitb197d20c083da1cbfd32e79c4a4c8f36de3a6aae (patch)
tree88705d9e44be35b97e6e8bf44816bf3747587496 /Source
parentc4708c5928a1476d9fe1c35856552994042ee7f0 (diff)
parentbb42e1ed43cc56581e7d16ec93a417b7971d108b (diff)
downloadCMake-b197d20c083da1cbfd32e79c4a4c8f36de3a6aae.zip
CMake-b197d20c083da1cbfd32e79c4a4c8f36de3a6aae.tar.gz
CMake-b197d20c083da1cbfd32e79c4a4c8f36de3a6aae.tar.bz2
Merge topic 'objc-xcode-flags' into release-3.16
bb42e1ed43 ObjC: Add OBJC/OBJCXX flags to Xcode projects Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4020
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx25
1 files changed, 17 insertions, 8 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index adeb065..c457cd1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2220,7 +2220,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// extract C++ stdlib
for (auto const& language : languages) {
- if (language != "CXX") {
+ if (language != "CXX" && language != "OBJCXX") {
continue;
}
std::string& flags = cflags[language];
@@ -2229,8 +2229,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->ExtractFlagRegex("(^| )(-stdlib=[^ ]+)( |$)", 2, flags);
if (stdlib.size() > 8) {
const auto cxxLibrary = stdlib.substr(8);
- buildSettings->AddAttribute("CLANG_CXX_LIBRARY",
- this->CreateString(cxxLibrary));
+ if (language == "CXX" ||
+ !buildSettings->GetObject("CLANG_CXX_LIBRARY")) {
+ buildSettings->AddAttribute("CLANG_CXX_LIBRARY",
+ this->CreateString(cxxLibrary));
+ }
}
}
@@ -2244,16 +2247,22 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString("NO"));
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
this->CreateString("NO"));
+
for (auto const& language : languages) {
std::string flags = cflags[language] + " " + defFlags;
- if (language == "CXX") {
- buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
- this->CreateString(flags));
+ if (language == "CXX" || language == "OBJCXX") {
+ if (language == "CXX" ||
+ !buildSettings->GetObject("OTHER_CPLUSPLUSFLAGS")) {
+ buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
+ this->CreateString(flags));
+ }
} else if (language == "Fortran") {
buildSettings->AddAttribute("IFORT_OTHER_FLAGS",
this->CreateString(flags));
- } else if (language == "C") {
- buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags));
+ } else if (language == "C" || language == "OBJC") {
+ if (language == "C" || !buildSettings->GetObject("OTHER_CFLAGS")) {
+ buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags));
+ }
} else if (language == "Swift") {
buildSettings->AddAttribute("OTHER_SWIFT_FLAGS",
this->CreateString(flags));