Omitting module in Qt pro file under Windows

Viewed 69

The Qt pro file begins as follows:

QT += core gui
QT += serialport
QT += displaysettings

This builds for my Hummingboard running Debian Linux. However displaysettings isn't available for Windows builds.I want to exclude this module from windows builds. I can exclude the function calls in the code from compiling. But adding displaysettings here causes an error.

2 Answers

The answer I accepted is good. Since then I've learned that displaysettings is very hardware dependent. It's available on my ARM processor running Armbian, but not on Linux running Intel and AMD processors. I wanted a solution that that works regardless of OS/processor combination. Thanks to Qt tech support I've used qtHaveModule like so:

qtHaveModule(displaysettings) {
QT += displaysettings
}

And this works great. More info @ https://doc.qt.io/qt-5/qmake-test-function-reference.html#qthavemodule-name

Thank you eyllanesc for you answer.

Related