Where to set conditional compile symbols in QtCreator?
I am working on a QtWebKit project, where modules are enabled using the ENABLE(XXX) macros, which test for ENABLE_XXX to be defined. They are defined for the build in the .config file, but QtCreator does not know that the module has been linked in, and the code block is grayed out. Is there a way to have QtCreator read this .config file or some other way of setting the symbols so I can set breakpoints?
I am building using a custom build step (build-webkit) and not using shadow builds.
Setting the symbols in header files is not an option as it would break QtWebKit builds for everyone else.
Creator should parse the config file if it is included somewhere.
Where/how would I include the .config file?
I don't know your code, sorry.
Usually you get a config.h file in C syntax with a lot of defines/undefines. This file is included all over the prokect. and Qt Creator should pick all the macros up. If it does not, then please "file a bug report":http://bugreports.qt-project.org/ .
Other projects will just call the compiler with -DSOMETHING arguments or include/exclude files from building based on some configuration. Whether creator will do the right thing here depends mostly on the build system used (qmake should work IIRC, maybe autotools, cmake most likely not). There is unfortunately no way to manually add defines to a project.
<REALLY DIRTY HACK>
You can sneak macros into creator with a wrapper script around your compiler (provided it is GCC based): Creator runs "gcc -xc++ -E -dM ADDITIONAL_ARGS_FROM_BUILDSYSTEM -" to find all the predefined macros of a the compiler. If your wrapper amends more macros to that output then those will be honored by the code model. You can then set up your wrapper script as a new tool chain and use that to build.
</REALLY DIRTY HACK>
Any changes in this area?
I am creating a project using CMake that sets several targets for the same codebase using the "target_compile_definitions" function of CMake in order to set different #defines for each target.
When I try to add a .config file in Qt Creator, it seems unable to discover it. I even added the .config file to the CMake list of sources without luck.
Any tips? (besides the <REALLY DIRTY HACK>, that is).