Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qmake: using defines as conditionals

Tags:

qt

qt5

qmake

How can I define variables to be used in the qmake .pro file? For instance:

DEFINES += MYCONDITION # also used in C++ code
MYCONDITION {
   # do something here
}

Regards,

like image 890
Hyndrix Avatar asked Mar 08 '26 09:03

Hyndrix


2 Answers

You should use CONFIG += MYCONDITION if you want to create a conditional in the project file and DEFINES to create a conditional for header and cpp files(USING #ifdef etc)

like image 139
Antonio Dias Avatar answered Mar 11 '26 09:03

Antonio Dias


you can use CONFIG

CONFIG += qt console newstuff
newstuff {
    SOURCES += new.cpp
    HEADERS += new.h
}
like image 22
0xFFFFFFFF Avatar answered Mar 11 '26 09:03

0xFFFFFFFF



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!