[Split]using #ifdef with a Qt-optional Application...
-
Since this thread got split off from another one, I'm going to re-write my question.
I'm working on an app that uses a bit of Qt for some entirely ancillary purposes. Pretty soon, I need to demo the app to management. The rub is that he wants to see it work without any of the Qt stuff.
The Qt code is confined to a few files, and it would seem that using #ifdef statements would be a good way to isolate out the Qt-specific code. Note that I'm not trying to alter the app for platform-specific considerations; I'm merely looking to disable the Qt stuff and still have the app build and run.
So...in any of the Qt header files, is there some safe-to-use tag definition that I could use for this purpose? Something that will always be present when developing within the context of Qt, but not otherwise? Or...is there a more sensible way to do this?
Once I can convince him that Qt isn't intrusive into the app, it will be easier to get him to allow further use of it, for this app and ones following. If I give him the impression that it's too enmeshed, though, I'm afraid he'll just force me to use Visual C++ (and none of us want that).
Thanks for any suggestions.
[EDIT: split off "this thread":http://developer.qt.nokia.com/forums/viewthread/2030, Volker]
-
You will most likely want your executable not to link against Qt, too. So using #ifdef on some section of the code is not enough. This is a classic job for your build system. You need to have it support two configurations, one with Qt and one without. The first builds and links the Qt files and links against Qt and the second one does not. This way you will hardly need any #ifdefs in your code (have the buildsystem define/undefine some macro based on which configuration you are in to use whenever you do need a #ifdef).
How to actually do this depends heavily on the buildsystem you are using.