Closed Adding files to .pro dependent upon Qt Version



  • I have a code base that includes several project files based on Mac / Linux / Windows target, one of these is to generate an OpenGL 3.2 context under Mac.

    Now we have Qt 5 I don't need this file and want to exclude it when building for Qt5 however I would like to still keep the project so I can build for Qt 4.x How would I approach this in qmake?

    I have tried this

    contains($$[QT_VERSION],"4.")
    {
    OBJECTIVE_SOURCES += $$SRC_DIR/setGL32VisualMac.mm
    }

    But it doesn't seem to work when using Qt5 and it still includes the file, does anyone have any ideas how I can exclude a file based on Qt Version?



  • @
    isEqual(QT_MAJOR_VERSION, 4) {
    ...
    }
    @



  • Brilliant, worked a treat, this should be put in the qmake user guide as I didn't see it in there.

    thanks

    Jon



  • You're welcome.

    The qmake documentation definitely needs some love, yes.



  • I agree I know quite a few qmake hacks but the isEqual one is new to me. I will will add it to my lecture notes!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.