[cmake-developers] Qt4 external binary resources

Joshua Collins josh.collins242 at gmail.com
Tue Feb 23 01:46:04 EST 2016


Hi,

I have an issue with using Qt 4 compiled resources on MSVC 2015 due to the
"compiler running out of heap space". I have decided to instead use
external binary resources on Windows builds as this seems to be the
simplest fix.

I am able to generate a binary resource with the following commands:

QT4_ADD_RESOURCES(RCC "main.qrc" OPTIONS "-binary")
ADD_EXECUTABLE(target source ${RCC})

The problem is that the QT4_ADD_RESOURCES will *always* create a cxx file.
This means that the add_executable command will attempt to compile the
binary source file.

The behaviour I would like to see would be to name the file "qrc_main.rcc"
if we are producing binary resources. As this is not a C++ file extension,
add_executable will not try to compile this generated file.

I am making the assumption that it is required to add RCC to the executable
to force it to be generated automatically. If there is a simple solution to
my setup that I have overlooked, please let me know.

I have thought of 2 ways to fix the issue and wanted to post this to the
mailing list for feedback before submitting a patch:
1. We can allow the user to pass a TARGET parameter to the macro. Currently
the  rcc_target parameter of the macro is unused. This would be used to
generate a user specified filename, which in this case could be
"myfile.rcc". The issue with this approach is that "-name ${outfilename} "
is passed to rcc and I am unsure of the implications of this parameter. A
generic target name may not fit the inherent naming convention in the
current implementation.
2. We can scan for the "-binary" option and automatically change the file
extension to rcc in this case. My concern here is that it is a bit "magic".

I would appreciate feedback on these approaches, or suggestions for easier
ways to solve the problem.

Best Regards,
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160223/85670ce2/attachment.html>


More information about the cmake-developers mailing list