PDA

View Full Version : preprocessor definition in QtCreator?



marc2050
30th July 2011, 01:59
Hi.

I would like to define a preprocessor.
But not in the .pro DEFINES.
But in my build environment?
I'm using QtCreator and like to know how do I set the preprocessor definition in the Build Settings.
Thanks!

ChrisW67
30th July 2011, 04:13
You can put any processing steps you like in the build process:

Projects
Build Settings
Build Steps
Add Build step, Custom Process Step, and configure to your heart's content.

If you intend to share the build with others and you don't capture this step in the PRO file they will have to use Qt Creator and you will have to include the Qt Creator project file.

marc2050
30th July 2011, 07:33
Thanks.

So what is the keyword I could use to do a preprocessor define? In Visual C++, we just add whatever we like to define under the Preprocess entry. But in this case, what do I place in the custom build step? PREPROCESS = <whatIdefine>? Thanks again.

ChrisW67
30th July 2011, 07:58
You put whatever actual operating system commands you want to execute into the Qt Creator build steps.

If you want to try to roll it into the PRO file, where you have access to file names, then you should look at the custom compilers stuff in:
http://www.qtcentre.org/wiki/index.php?title=Undocumented_qmake#Custom_tools

mvuori
30th July 2011, 09:16
He is not actually trying a define a preprocessor, but preprocessor variables... (like #define _WIN32, expressed by DEFINES in .pro files).

(And I don't know how to do it in build settings either.)

wysota
30th July 2011, 11:55
One can pass arbitrary statements to qmake (e.g. qmake DEFINES+=xyz) although as Chris already stated doing so in Creator's project settings one forces others to use his Creator configuration file. Adding the statements to the .pro file using the "DEFINES" variable is the proper approach.