From 0e04fbf1cde023644a2d784a862d00f3ca5d71ef Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 27 Oct 2017 15:52:29 +0100 Subject: [PATCH] Projucer: Don't set the windows target platform version in the .jucer file if it isn't specified --- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h index a6e2ef5ef72b..71039fd7bcf8 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_MSVC.h @@ -84,12 +84,9 @@ class MSVCProjectExporterBase : public ProjectExporter void addWindowsTargetPlatformProperties (PropertyListBuilder& props) { - if (getWindowsTargetPlatformVersionValue() == Value()) - getWindowsTargetPlatformVersionValue() = getDefaultWindowsTargetPlatformVersion(); - auto isWindows10SDK = getVisualStudioVersion() > 14; - props.add (new TextPropertyComponent (getWindowsTargetPlatformVersionValue(), "Windows Target Platform", 20, false), + props.add (new TextWithDefaultPropertyComponent (windowsTargetPlatformVersion, "Windows Target Platform", 20), String ("Specifies the version of the Windows SDK that will be used when building this project. ") + (isWindows10SDK ? "You can see which SDKs you have installed on your machine by going to \"Program Files (x86)\\Windows Kits\\10\\Lib\". " : "") + "The default value for this exporter is " + getDefaultWindowsTargetPlatformVersion()); @@ -103,11 +100,8 @@ class MSVCProjectExporterBase : public ProjectExporter void addWindowsTargetPlatformVersionToPropertyGroup (XmlElement& p) const { - const String& targetVersion = getWindowsTargetPlatformVersion(); - - if (targetVersion.isNotEmpty()) - forEachXmlChildElementWithTagName (p, e, "PropertyGroup") - e->createNewChildElement ("WindowsTargetPlatformVersion")->addTextElement (getWindowsTargetPlatformVersion()); + forEachXmlChildElementWithTagName (p, e, "PropertyGroup") + e->createNewChildElement ("WindowsTargetPlatformVersion")->addTextElement (getWindowsTargetPlatformVersion()); } void addIPPSettingToPropertyGroup (XmlElement& p) const @@ -151,6 +145,12 @@ class MSVCProjectExporterBase : public ProjectExporter TargetOS::windows))); } + void initialiseWindowsTargetPlatformVersion() + { + windowsTargetPlatformVersion.referTo (settings, Ids::windowsTargetPlatformVersion, + nullptr, getDefaultWindowsTargetPlatformVersion()); + } + //============================================================================== class MSVCBuildConfiguration : public BuildConfiguration { @@ -1443,6 +1443,7 @@ class MSVCProjectExporterBase : public ProjectExporter //============================================================================== mutable File rcFile, iconFile; OwnedArray targets; + CachedValue windowsTargetPlatformVersion; File getProjectFile (const String& extension, const String& target) const { @@ -1839,6 +1840,7 @@ class MSVCProjectExporterVC2013 : public MSVCProjectExporterBase : MSVCProjectExporterBase (p, t, "VisualStudio2013") { name = getName(); + initialiseWindowsTargetPlatformVersion(); } static const char* getName() { return "Visual Studio 2013"; } @@ -1882,6 +1884,7 @@ class MSVCProjectExporterVC2015 : public MSVCProjectExporterBase : MSVCProjectExporterBase (p, t, "VisualStudio2015") { name = getName(); + initialiseWindowsTargetPlatformVersion(); } static const char* getName() { return "Visual Studio 2015"; } @@ -1924,6 +1927,7 @@ class MSVCProjectExporterVC2017 : public MSVCProjectExporterBase : MSVCProjectExporterBase (p, t, "VisualStudio2017") { name = getName(); + initialiseWindowsTargetPlatformVersion(); } static const char* getName() { return "Visual Studio 2017"; }