qmake: using defines as conditionals

一个人想着一个人 提交于 2019-12-11 00:58:15

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!