Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Closed Adding files to .pro dependent upon Qt Version
Forum Updated to NodeBB v4.3 + New Features

Closed Adding files to .pro dependent upon Qt Version

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jmacey
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jmacey
        wrote on last edited by
        #3

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

        thanks

        Jon

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          You're welcome.

          The qmake documentation definitely needs some love, yes.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jmacey
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved