1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Added a method to check old exporter settings for the C++ language standard setting and to use this value as the default if it hasn't been set

This commit is contained in:
ed 2017-07-24 09:45:37 +01:00
parent df14b18c17
commit 7582952cdf
2 changed files with 52 additions and 1 deletions

View file

@ -152,12 +152,62 @@ void Project::setMissingDefaultValues()
if (shouldIncludeBinaryInAppConfig() == var())
shouldIncludeBinaryInAppConfig() = true;
if (! projectRoot.hasProperty (Ids::cppLanguageStandard))
if (! projectRoot.hasProperty (Ids::cppLanguageStandard) && ! setCppVersionFromOldExporterSettings())
getCppStandardValue() = "11";
ProjucerApplication::getApp().updateNewlyOpenedProject (*this);
}
bool Project::setCppVersionFromOldExporterSettings()
{
auto highestLanguageStandard = -1;
for (Project::ExporterIterator exporter (*this); exporter.next();)
{
if (exporter->isXcode()) // cpp version was per-build configuration for xcode exporters
{
for (ProjectExporter::ConfigIterator config (*exporter); config.next();)
{
auto cppLanguageStandard = config->getValue (Ids::cppLanguageStandard).getValue();
if (cppLanguageStandard != var())
{
auto versionNum = cppLanguageStandard.toString().getLastCharacters (2).getIntValue();
if (versionNum > highestLanguageStandard)
highestLanguageStandard = versionNum;
}
}
}
else
{
auto cppLanguageStandard = exporter->getSetting (Ids::cppLanguageStandard).getValue();
if (cppLanguageStandard != var())
{
if (cppLanguageStandard.toString().containsIgnoreCase ("latest"))
{
getCppStandardValue() = "latest";
return true;
}
auto versionNum = cppLanguageStandard.toString().getLastCharacters (2).getIntValue();
if (versionNum > highestLanguageStandard)
highestLanguageStandard = versionNum;
}
}
}
if (highestLanguageStandard != -1 && highestLanguageStandard >= 11)
{
getCppStandardValue() = highestLanguageStandard;
return true;
}
return false;
}
void Project::updateDeprecatedProjectSettingsInteractively()
{
jassert (! ProjucerApplication::getApp().isRunningCommandLine);