title: Qt and Windows Executable Version Information
body: <p>My Windows Qt widgets application uses a "version.h" file and an "RC" file to populate the version information strings against an executable.</p>
  
  <p>The version.h looks like this...</p>
  
  <pre><code>#ifndef VERSION_H
  #define VERSION_H
  
  #define VERSION_MAJOR                           1
  #define VERSION_MINOR                           0
  #define VERSION_BUILD                           3
  
  #define VER_FILEVERSION           VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD,0
  #define STR_FILEVERSION                     VERSION_MAJOR##"."##VERSION_MINOR##"."VERSION_BUILD##".0"
  
  // Keep the product version as fixed
  #define VER_PRODUCTVERSION        1.0.0.0
  #define STR_PRODUCTVERSION          "1.0.0.0\0"
  
  #define STR_COMPANYNAME                     "MyCompany"
  #define STR_FILEDESCRIPTION             "MyFile"
  #define STR_INTERNALNAME                    "MyFile"
  #define STR_LEGALCOPYRIGHT              "Copyright © 2017 MyCompany"
  #define STR_LEGALTRADEMARKS1            "All Rights Reserved"
  #define STR_LEGALTRADEMARKS2            STR_LEGALTRADEMARKS1
  #define STR_ORIGINALFILENAME            "MyApp.exe"
  #define STR_PRODUCTNAME                     "MyApp"
  
  #define STR_COMPANYDOMAIN                   "mywebsite.com"
  
  #endif // VERSION_H
  </code></pre>
  
  <p>And the RC file looking like:</p>
  
  <pre><code>IDI_APP_ICON    ICON    DISCARDABLE     "MyApp.ico"
  
  #include &lt;windows.h&gt;
  #include "version.h"
  
  VS_VERSION_INFO VERSIONINFO
  FILEVERSION     VER_FILEVERSION
  PRODUCTVERSION  VER_PRODUCTVERSION
  BEGIN
      BLOCK "StringFileInfo"
      BEGIN
          BLOCK "040904E4"
          BEGIN
              VALUE "CompanyName",        STR_COMPANYNAME
              VALUE "FileDescription",    STR_FILEDESCRIPTION
              VALUE "FileVersion",        STR_FILEVERSION
              VALUE "InternalName",       STR_INTERNALNAME
              VALUE "LegalCopyright",     STR_LEGALCOPYRIGHT
              VALUE "LegalTrademarks1",   STR_LEGALTRADEMARKS1
              VALUE "LegalTrademarks2",   STR_LEGALTRADEMARKS2
              VALUE "OriginalFilename",   STR_ORIGINALFILENAME
              VALUE "ProductName",        STR_PRODUCTNAME
              VALUE "ProductVersion",     STR_PRODUCTVERSION
          END
      END
  
      BLOCK "VarFileInfo"
      BEGIN
          VALUE "Translation", 0x409, 1252
      END
  END
  </code></pre>
  
  <p>And for completeness, the ".pro" file has this line inside:</p>
  
  <pre><code>RC_FILE    = MyApp.rc
  </code></pre>
  
  <p>This all seems to work OK: when I right-click the exe and go to the details tab, I can see the version information and all other strings from the combined version.h and RC files.</p>
  
  <p>However, if I increase the any one of the VERSION_XXX #define values and build the application, I've noticed that the reported "File version" hasn't changed - only when I do a "rebuild" does the version change.</p>
  
  <p>I don't really want to have to do a complete rebuild every time I increase the version information (mainly VERSION_BUILD at the moment) so what may I need to do in order to get this information updated each time the exe is built?</p>