Qmake created rc files and windres (MinGW)
-
I am using Qt 4.7.3 with MinGW and I tried to automate the integration of vendor/file information into the exe file. I tried it in the same way as it is done in the Qt sources in my .pro file:
@VERSION = 0.4.0.1
QMAKE_TARGET_COMPANY = company
QMAKE_TARGET_PRODUCT = product
QMAKE_TARGET_DESCRIPTION = description
QMAKE_TARGET_COPYRIGHT = copyright@That creates a .rc file which looks like this:
@# if defined(UNDER_CE)include <winbase.h>
else
include <winver.h>
endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,4,0,1
PRODUCTVERSION 0,4,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "company\0"
VALUE "FileDescription", "description\0"
VALUE "FileVersion", "0.4.0.1\0"
VALUE "LegalCopyright", "copyright\0"
VALUE "OriginalFilename", "Test.exe\0"
VALUE "ProductName", "product\0"
END
END
END
/* End of Version info */
@The problem is, that windres seems to ignore the whole StringFileOnfo-Block. If I only change a little in the .rc file:
@# if defined(UNDER_CE)include <winbase.h>
else
include <winver.h>
endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,4,0,1
PRODUCTVERSION 0,4,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "company\0"
VALUE "FileDescription", "description\0"
VALUE "FileVersion", "0.4.0.1\0"
VALUE "LegalCopyright", "copyright\0"
VALUE "OriginalFilename", "Test.exe\0"
VALUE "ProductName", "product\0"
END
END
BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. /
/ It consists of any number of WORD,WORD pairs, with each pair /
/ describing a language,codepage combination supported by the file. /
/ /
/ For example, a file might have values "0x409,1252" indicating that it /
/ supports English language (0x409) in the Windows ANSI codepage (1252). /
VALUE "Translation", 0x409, 1252
END
END
/ End of Version info */
@
and include it with RC_FILE =, then all data is included. I don't know if it is qmake which forgets the VarFileInfo part, or windres, which goes crazy when this block is missing, but I would really like to have this feature working!Thanks for your help, if you need further information or if you have suggestions, please let me know!
-
Hi,
Do you know how to pass through the preprocessor DEFINES the CompanyName, or FileDescription string in the .pro? I'm struggling with string expansion
Usually to pass a string via -D, I use the following escaping in the .pro but it doesn't work for the StringFileInfo:
@
MYCOMPANY="Hello Inc.\0"
DEFINES += COMPANYNAME="\"$$MYCOMPANY\""
@Any hints?