skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


  2. Use:

    QT += core gui
    QT += serialport
    !win32 {
        QT += displaysettings
    }
    

    For more information read https://doc.qt.io/qt-5/qmake-language.html#scopes-and-conditions

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search