我认为你的qmake定义有点像。这个
CONFIG(debug, debug|release)
语法是一种特殊的构造,两者总是被定义的,这就发现实际上使用了witch build。对于静态,情况并非如此,因此只需将其定义为:
CONFIG(debug, debug|release ) {
#debug build
LIBS += ../third-party-library/debug/library.lib
} else:CONFIG(release, debug|release) {
static {
#static release build
LIBS += ../third-party-library/static/library.lib
} else {
#non-static release build
LIBS += ../third-party-library/release/library.lib
}
}
debug
和
release
因此需要特殊构造,请阅读此处:
https://doc.qt.io/qt-5/qmake-test-function-reference.html#config-config
使用
static
这样做的唯一原因是qmake从
CONFIG
变量它基本上是
contains(CONFIG, static)
.