Pre-Processor variable for Kits?
-
Hi,
I am using 2 kits for my project - one for MinGW 32 bit while the other for MinGW 64 bit.
I have some code in a .cpp file which is used for either of them and I want to decide that using a pre-processor directive:@#ifdef(64bitKit)
//64 bit code
#else
//32 bit code
#endif@Also I want to use a similar mechanism for my .pro file.
How can I do this? -
If your target is windows, you can use:
#if defined(Q_OS_WIN64)
...#if defined(Q_OS_WIN32)
... -
For .pro files take a look "here":http://qt-project.org/faq/answer/how_can_i_detect_in_the_.pro_file_if_i_am_compiling_for_a_32_bit_or_a_64_bi#899
-
Alternatively you can do this in your Qt Create Project settings. Your project has two kits associated with it. Each kit build configuration has a qmake command line associated with it. You can add additional arguments to the qmake line to create pre-processor symbols you can use in your code. For example:
@
DEFINES+="BITNESS=32"
@
or
@
DEFINES+="BITNESS=64"
@