summaryrefslogtreecommitdiff
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-23 10:52:31 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-23 10:52:31 -0400
commit711073e8c659291fc21a1498a1240eef4922369c (patch)
treee27608cc54e2692ece74baf2e72e3cd1fbc18aad /Source/cmGlobalXCodeGenerator.cxx
parent79e40f830f4b2ab31b39af604322b7c7a002d1c6 (diff)
parent332350b9c4e6cd198315167664104e645ad3d7ff (diff)
downloadcmake-711073e8c659291fc21a1498a1240eef4922369c.tar.gz
Merge topic 'xcode-attributes-variant'
332350b Xcode: Support XCODE_ATTRIBUTE_ with [variant=<config>] (#12532)
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx35
1 files changed, 33 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index c739dcb06b..bb1e792851 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2237,8 +2237,39 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
{
if(i->first.find("XCODE_ATTRIBUTE_") == 0)
{
- buildSettings->AddAttribute(i->first.substr(16).c_str(),
- this->CreateString(i->second.GetValue()));
+ cmStdString attribute = i->first.substr(16);
+ // Handle [variant=<config>] condition explicitly here.
+ cmStdString::size_type beginVariant =
+ attribute.find("[variant=");
+ if (beginVariant != cmStdString::npos)
+ {
+ cmStdString::size_type endVariant =
+ attribute.find("]", beginVariant+9);
+ if (endVariant != cmStdString::npos)
+ {
+ // Compare the variant to the configuration.
+ cmStdString variant =
+ attribute.substr(beginVariant+9, endVariant-beginVariant-9);
+ if (variant == configName)
+ {
+ // The variant matches the configuration so use this
+ // attribute but drop the [variant=<config>] condition.
+ attribute.erase(beginVariant, endVariant-beginVariant+1);
+ }
+ else
+ {
+ // The variant does not match the configuration so
+ // do not use this attribute.
+ attribute.clear();
+ }
+ }
+ }
+
+ if (!attribute.empty())
+ {
+ buildSettings->AddAttribute(attribute.c_str(),
+ this->CreateString(i->second.GetValue()));
+ }
}
}
}