mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
IPO: INTERPROCEDURAL_OPTIMIZATION (LTCG) for Visual Studio
Add IPO support for Visual Studio (which is referred to by VS as "Link Time Code Generation" and "Whole Program Optimization"), for VS version >= 10. This allows CMake/VS users to enable IPO by setting property `INTERPROCEDURAL_OPTIMIZATION`. Fixes: #16748
This commit is contained in:
@@ -1122,6 +1122,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
|
||||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) {
|
||||
e1.Element("WindowsAppContainer", "true");
|
||||
}
|
||||
if (this->IPOEnabledConfigurations.count(config) > 0) {
|
||||
e1.Element("WholeProgramOptimization", "true");
|
||||
}
|
||||
}
|
||||
|
||||
void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
|
||||
@@ -2485,8 +2488,10 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
|
||||
clOptions.AddFlag("CompileAs", "CompileAsCpp");
|
||||
}
|
||||
|
||||
// Check IPO related warning/error.
|
||||
this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName);
|
||||
// Put the IPO enabled configurations into a set.
|
||||
if (this->GeneratorTarget->IsIPOEnabled(linkLanguage, configName)) {
|
||||
this->IPOEnabledConfigurations.insert(configName);
|
||||
}
|
||||
|
||||
// Get preprocessor definitions for this directory.
|
||||
std::string defineFlags = this->Makefile->GetDefineFlags();
|
||||
|
||||
Reference in New Issue
Block a user