Pre-processor-defines depending on makefile-targets ?
Hi,
I'm searching for a possibility to create pre-processor-defines depending on the called makefile target.
I'm currently using the usual solution for conditional compiling of debug code parts:
Code:
#ifdef DEBUG
...debug-code
#endif
At the moment, I set DEBUG in a separate header-file, which I have to include in all souces that contain such debug-sequences.
My idea/intention is to make this separate header-file obsolete. DEBUG should be set when I compile the software with "make debug" (only).
It's a qmake-project and I use CONFIG += debug_and_relase.
I know the DEFINES option, but don't know how to make it depending on the called make target. Does anyone know how to do that ?
Frank
Re: Pre-processor-defines depending on makefile-targets ?
Have you tried ?
Code:
debug:DEFINES += __MY_DEBUG_DEFINE__
release:DEFINES += __MY_RELEASE_DEFINE__
Re: Pre-processor-defines depending on makefile-targets ?
Thanks for your answer ! Yes, I already tried that but it doesn't work :(:
Becasue of CONFIG += debug_and_release, always both (__MY_DEBUG_DEFINE__ and __MY_RELEASE_DEFINE__) will be defined. It doesn't matter which makefile-target I call...
Re: Pre-processor-defines depending on makefile-targets ?
I finally solved it:
Code:
CONFIG(debug, debug|release) {
DEFINES = __MY_DEBUG_DEFINE__
} else {
DEFINES = __MY_RELEASE_DEFINE__
}
I still don't understand CONFIG(...) completely, documentation is really incomplete for stuff like this...
Re: Pre-processor-defines depending on makefile-targets ?
Have you seen the article in our wiki regarding [wiki]Undocumented qmake[/wiki] features?