diff options
author | Cédric OCHS <kervala@gmail.com> | 2012-12-12 15:42:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-05-22 19:20:10 (GMT) |
commit | 332350b9c4e6cd198315167664104e645ad3d7ff (patch) | |
tree | bd4b971d49861e1e539610fe58b8789686cec6f6 /Source/cmGlobalXCodeGenerator.cxx | |
parent | 4825d70e830395ebff09a7fba73eb6ff5661048b (diff) | |
download | CMake-332350b9c4e6cd198315167664104e645ad3d7ff.zip CMake-332350b9c4e6cd198315167664104e645ad3d7ff.tar.gz CMake-332350b9c4e6cd198315167664104e645ad3d7ff.tar.bz2 |
Xcode: Support XCODE_ATTRIBUTE_ with [variant=<config>] (#12532)
Since commit c519bb2b (XCode: Also qoute [] as needed to set
build-configurations, 2011-04-05) we escape "[]" conditions for
XCODE_ATTRIBUTE_ settings. However, we need to handle the "variant"
condition with a special case to map it only into the settings for the
matching configuration.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 870bfa1..7973822 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2241,8 +2241,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())); + } } } } |