diff options
author | Evan Wilde <etceterawilde@gmail.com> | 2022-10-11 16:56:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-14 13:23:47 (GMT) |
commit | 238e0f25b273420efe8a49292c0f4f267f359db2 (patch) | |
tree | 4082ad8f5fb04fa2f477e40a64b55b5e8a498185 /Source/cmGlobalXCodeGenerator.cxx | |
parent | 6063428de7707f68b14d74d93d5440c61cc50cf4 (diff) | |
download | CMake-238e0f25b273420efe8a49292c0f4f267f359db2.zip CMake-238e0f25b273420efe8a49292c0f4f267f359db2.tar.gz CMake-238e0f25b273420efe8a49292c0f4f267f359db2.tar.bz2 |
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.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6b867d4..c28b22b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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()) { |