Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if/else if equivalent for qmake/pro Qt file

I sometimes have to write qmake pro file like this:

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;
}

Is there a way to have avoid listing all unsupported plateform in a simpler way like most language allow if if/else if statement?

like image 572
Martin Delille Avatar asked Oct 28 '25 16:10

Martin Delille


1 Answers

qmake knowns about 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")
}
like image 85
chehrlic Avatar answered Oct 31 '25 07:10

chehrlic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!