Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
None
-
2.5.2
-
None
-
Visual Studio 2017
-
-
f3afc13bd (dev)
Description
When creating a new (non Qt) project using the stock Visual Studio project wizard, it sets up a block of properties for every build configuration in the .vcxproj, for example:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <PlatformToolset>v141</PlatformToolset> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <PlatformToolset>v141</PlatformToolset> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup>
When using the Qt project wizard provided by the Qt VS Tools, it only sets up a subset of these properties:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v141</PlatformToolset> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v141</PlatformToolset> </PropertyGroup>
Note that "UseDebugLibraries", "CharacterSet" and "WholeProgramOptimization" are missing.
This causes various issues:
- "UseDebugLibraries" is used by VS to switch between Debug and Release Runtime Library and Optimization Settings, which doesn't work without this property. The Qt VS Tools work around this issue by explicitly specifying all the individual build settings like "RuntimeLibrary", "Optimization", "DebugInformationFormat", etc.. (which don't match the VS defaults in all cases). It would be much better to just use the default VS behavior by setting "UseDebugLibraries"
- "WholeProgramOptimization" enables Link Time Code Generation for Release Builds. Because this property is missing for Qt projects, LTCG is disabled.
- "CharacterSet" explicitly defines the Windows character set. Not so much of an issue for Qt projects.
These inconsistencies cause various issues when maintaining a large code base with various Qt and non-Qt projects, because every Qt projects differs from all the other non-Qt projects and need to be adjusted manually.
In conclusion: Qt VS Tools should set all the configuration properties just like the VS built-in project wizards do. On the other end, the Qt Wizard should NOT set all the individual, hand-crafted build properties (RuntimeLibrary, DebugInformationFormat, ...) that are currently set to work-around the issue (and conflict with the VS defaults provided by Microsoft property sheets).