开发者

How to add flags to RC.EXE through QMake .pro makefiles

开发者 https://www.devze.com 2022-12-29 00:25 出处:网络
I\'ve the following definition in my .pro file: RC_FILE = app.rc This RC file contains a global include at the top:

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 i开发者_C百科s 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.


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.


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")


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号