Use of #if defined in C++ to select a Qt Kit
Similarly to the directive:
used to switch from something for Linux to something for other O.S., how can I set in C++ to switch from a Kit for Embedded System (based on OMAP Embedded to a Kit for Desktop?
#if defined(...what instruction...) ?
OR Can I add a Build Environment variable for my own use and how to use it?
You can't switch kits from code. It's you that defines which kit to use when you configure Qt Creator.
In .pro file you can specify DEFINES as per compilers used.
DEFINES += WIN_DESKTOP
In .cpp files you can use
qDebug()<<"Running in Linux Desktop"<<endl;
qDebug()<<"Running in Windows Desktop"<<endl;
This should help you.
Thank you yuvaram, based on your indication I defined my own variable in one of two .pro files for my project that can be compiled using two different kits (for Dektop OR Embedded); thus, checking if it is defined or not, now I'm able to compile the version I'd like.
Ok, so it was the other way around, enabling code depending on which platform ?
In that case you don't have to create any defines. You have the
Q_OS_XXXdefines that you can easily use in your application code.