Hi, we have a Qt project and the Qt tool ‘rcc’ is generating .cpp files during the build step. We need to specify additional compile flags (change symbol visibility) and I was wondering if we can somehow iterate over those generated files to make these adjustments before the compiler is running.
Certainly not at build time. But if the list of files is known at compile time (as they would certainly with the older qt5_wrap_rcc API), you could chain them into other sources with the required processing and add those to the library.
Another possible solution is to use the <LANG>_COMPILER_LAUNCHER property to detect, edit the files into a new path, and then use the new path when launching the actual compiler for the relevant files.
However, it sounds like getting rcc to know how to make the files directly would be best. If you just want to expose the symbols, would making a new file that exports its symbols and chains to the “hidden” symbols be sufficient?
Hi Ben,
thx for the fast respone. I’m not sure if I understood the last suggestion correctly, could you give an example for it?
A colleague of mine just found the CMAKE_GLOBAL_AUTORCC_TARGET variable but unfortunately we can’t use the target to add compile options because CMake complains that the target autorcc is not build by this project. What is the purpose of this variable?
If you write a shell script that inspects the command line, detects an rcc source and then does the patching and command line rewriting to the patched file, you can use that shell script as a “compiler launcher”. It’s been discussed as a solution for a number of things on Discourse; searching should be able to find them.