问题
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,
回答1:
you can use CONFIG
CONFIG += qt console newstuff
newstuff {
SOURCES += new.cpp
HEADERS += new.h
}
回答2:
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)
来源:https://stackoverflow.com/questions/34670326/qmake-using-defines-as-conditionals