mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
Xcode: Set WMO on non-debug build configurations
This patch sets the swift compilation mode to wholemodule in the xcode generator for all non-debug build configurations at the project level. Leaving the target build-configurations default ensures that this default can be overridden easily by editing either the project configuration from the build settings editor or the per-target configuration. When set on versions of Xcode that do not recognize the `SWIFT_COMPILATION_MODE` setting, Xcode will include the option as a user-defined setting, but otherwise ignore it.
This commit is contained in:
@@ -4378,12 +4378,20 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
||||
buildSettings->AddAttribute("CODE_SIGNING_ALLOWED",
|
||||
this->CreateString("NO"));
|
||||
}
|
||||
auto debugConfigs = this->GetCMakeInstance()->GetDebugConfigs();
|
||||
std::set<std::string> debugConfigSet(debugConfigs.begin(),
|
||||
debugConfigs.end());
|
||||
|
||||
for (auto& config : configs) {
|
||||
CreateGlobalXCConfigSettings(root, config.second, config.first);
|
||||
|
||||
cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings);
|
||||
|
||||
if (debugConfigSet.count(cmSystemTools::UpperCase(config.first)) == 0) {
|
||||
buildSettingsForCfg->AddAttribute("SWIFT_COMPILATION_MODE",
|
||||
this->CreateString("wholemodule"));
|
||||
}
|
||||
|
||||
// Put this last so it can override existing settings
|
||||
// Convert "CMAKE_XCODE_ATTRIBUTE_*" variables directly.
|
||||
for (const auto& var : this->CurrentMakefile->GetDefinitions()) {
|
||||
|
||||
Reference in New Issue
Block a user