diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2016-01-03 10:55:50 (GMT) |
---|---|---|
committer | Gregor Jasny <gjasny@googlemail.com> | 2016-01-03 21:31:12 (GMT) |
commit | d8bc26a065f1999698c9b499ca793f9adf740a9d (patch) | |
tree | f168d6d19a004affab6540549b809067cf8a4521 /Source/cmGlobalXCodeGenerator.cxx | |
parent | dc0ddb9e34f885d32f0fa3bb25072ec77e4a79bb (diff) | |
download | CMake-d8bc26a065f1999698c9b499ca793f9adf740a9d.zip CMake-d8bc26a065f1999698c9b499ca793f9adf740a9d.tar.gz CMake-d8bc26a065f1999698c9b499ca793f9adf740a9d.tar.bz2 |
Xcode: Parse variant and genex for CMAKE_XCODE_ATTRIBUTE (#14947)
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3ac1137..fa9af12 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -710,6 +710,15 @@ cmXCodeObject* cmGlobalXCodeGenerator } //---------------------------------------------------------------------------- +cmXCodeObject* cmGlobalXCodeGenerator +::CreateFlatClone(cmXCodeObject* orig) +{ + cmXCodeObject* obj = this->CreateObject(orig->GetType()); + obj->CopyAttributes(orig); + return obj; +} + +//---------------------------------------------------------------------------- std::string GetGroupMapKeyFromPath(cmGeneratorTarget* target, const std::string& fullpath) { @@ -3531,25 +3540,33 @@ bool cmGlobalXCodeGenerator symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); - // Put this last so it can override existing settings - // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. - { - std::vector<std::string> vars = this->CurrentMakefile->GetDefinitions(); - for(std::vector<std::string>::const_iterator i = vars.begin(); - i != vars.end(); ++i) + for(Configs::iterator i = configs.begin(); i != configs.end(); ++i) { - if(i->find("CMAKE_XCODE_ATTRIBUTE_") == 0) + cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings); + + // Put this last so it can override existing settings + // Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly. + std::vector<std::string> vars = this->CurrentMakefile->GetDefinitions(); + for(std::vector<std::string>::const_iterator d = vars.begin(); + d != vars.end(); ++d) { - buildSettings->AddAttribute(i->substr(22).c_str(), - this->CreateString( - this->CurrentMakefile->GetDefinition(i->c_str()))); + if(d->find("CMAKE_XCODE_ATTRIBUTE_") == 0) + { + std::string attribute = d->substr(22); + this->FilterConfigurationAttribute(i->first, attribute); + if(!attribute.empty()) + { + cmGeneratorExpression ge; + std::string processed = + ge.Parse(this->CurrentMakefile->GetDefinition(*d)) + ->Evaluate(this->CurrentLocalGenerator, i->first); + buildSettingsForCfg->AddAttribute(attribute, + this->CreateString(processed)); + } + } } - } - } - - for(Configs::iterator i = configs.begin(); i != configs.end(); ++i) - { - i->second->AddAttribute("buildSettings", buildSettings); + // store per-config buildSettings into configuration object + i->second->AddAttribute("buildSettings", buildSettingsForCfg); } this->RootObject->AddAttribute("buildConfigurationList", |