Mar*_*lle 3 qt qmake if-statement
我有时必须像这样编写 qmake pro 文件:
QMAKE_EXTRA_TARGETS += activate
macos {
clear_cache.commands += defaults write io.delille.$$TARGET activated 1;
}
win32 {
clear_cache.commands += another working command;
}
linux {
clear_cache.commands += echo unsupported;
}
ios {
clear_cache.commands += echo unsupported;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法避免像大多数语言允许 if if/else if语句那样以更简单的方式列出所有不受支持的平台?
小智 6
qmake 知道 if/else: https: //doc.qt.io/qt-5/qmake-language.html#scopes
win32:xml {
message(Building for Windows)
SOURCES += xmlhandler_win.cpp
} else:xml {
SOURCES += xmlhandler.cpp
} else {
message("Unknown configuration")
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4740 次 |
| 最近记录: |