我有时不得不像这样写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;
}
[是否有一种方法可以避免像大多数语言在if
/ else if
语句中所允许的那样以更简单的方式列出所有不受支持的平台?
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")
}