Question

I've the following definition in my .pro file:

RC_FILE = app.rc

This RC file contains a global include at the top:

#include "version_info.h"

The version_info.h header is on a common header files directory.

Since RC.EXE takes INCLUDE environment variable in consideration, according to MS documentation, my build process batch sets up that accordingly:

SET INCLUDE=%PROJECTDIR%\version;%INCLUDE%
...
QMAKE project.pro -spec win32-msvc2008 -r CONFIG += release

This works perfect as RC seems to read that INCLUDE var so the "version_info.h" file is including on every RC file properly.

The problem is when I generate a VS solution (or Import it through the VS Addin). The RC invocation does not contain any /I flag (as I expect) but does not read any INCLUDE variable, even when I've setup through system 'environment variables' dialog in XP.

So I'm stuck with this problem, with two alternatives I could not get to work:

  • Make VS RC.exe invocation honour the INCLUDE variable (didn't work either as user or system variable).
  • Force QMAKE to pass /I flag to RC invocation, and get that /I flag imported into the project settings (Resource Compiler properties).

Thanks in advance.

Was it helpful?

Solution

A bug is opened in Qt bugtracker

Until it solves, you have the following solutions: - hack the generated solution file (see the bug report for details) - explictely include the header file with path, without relying on INCLUDEPATH (e.g. #include "../../version.h")

OTHER TIPS

It is a bit hacky but works fine: use the QMAKE_RC qmake variable in your .pro file (or via arguments for qmake). By default it is defined as rc but you can set it as rc /i<directory> <any-other-rc-flags>". It would be better if QMAKE supports something like QMAKE_RC_FLAGS but it doesn't.

I don't know if you noticed, but the bugtracker bug @Bruce mentioned has been closed as of 5.0.0 RC2: https://codereview.qt-project.org/#change,41984

The variable you need to use is RC_INCLUDEPATH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top