Skip to content

Instantly share code, notes, and snippets.

@gavxin
Created May 15, 2017 09:31
Show Gist options
  • Save gavxin/a1a2f87a6c8021c00d1ab32ca390ce57 to your computer and use it in GitHub Desktop.
Save gavxin/a1a2f87a6c8021c00d1ab32ca390ce57 to your computer and use it in GitHub Desktop.
VS QT project when without QT VS plugin, it build all file everytime. Solve this...
1. You may be need config QTDIR into your project. This step makes you can build the project.
My way is create `qt.props` file, and add this props file to every project which using qt.
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<QTDIR Condition="'$(Platform)' == 'Win32'">%QT_MSVC2015_5_6%</QTDIR>
<QTDIR Condition="'$(Platform)' == 'x64'">%QT_MSVC2015_5_6_X64%</QTDIR>
</PropertyGroup>
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
```
Because every member could installed QT in different paths. So need configure following environment varialble.
QT_MSVC2015_5_6=X:\path\to\your\QT\library\msvc2015
QT_MSVC2015_5_6_X64=X:\path\to\your\QT\library\msvc2015_64
2. Open the xxx.vcxproj.user file and edit. This step stop build all file everytime.
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Platform)'=='Win32'">
<QTDIR>X:\path\to\your\QT\library\msvc2015</QTDIR>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='x64'">
<QTDIR>X:\path\to\your\QT\library\msvc2015_64</QTDIR>
</PropertyGroup>
</Project>
```
The xxx.vcxproj.user usually not include in your VCS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment