Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QMake: How do I change a compiler option which is already given a value by the framework
Forum Updated to NodeBB v4.3 + New Features

QMake: How do I change a compiler option which is already given a value by the framework

Scheduled Pinned Locked Moved Qt Creator and other tools
15 Posts 4 Posters 10.9k 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
    Jakob Schou
    wrote on last edited by
    #1

    I would like to add the compiler option -mmacosx-version-min=10.6. I have tried setting

    @QMAKE_CXXFLAGS += -mmacosx-version-min=10.6@

    in my .pro file. The problem is that this option is also given a value by the mkspecs config files - common/g++-macx.conf sets it to -mmacosx-version-min=10.5. The result is that the compiler command line will contain both my setting and the mkspecs setting. The mkspecs settings appears last and will get effect. How can I tell the compiler to use "-mmacosx-version-min=10.6"?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Tweak the mkspec, or create a new one by copying the original, changing the min version and name.

      (Z(:^

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

        Tweaking mkspec is what I am currently doing to work around the problem. It is not a good solution for me because mkspecs is obviously outside the source code repository so every developer must do it manually.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          You can copy the mkspec into your repo, but I do agree it's not a clean or nice solution. There is a Qt configure flag that allows for SDK selection, but I don't think there is one in qmake.

          This is what I've found. Does not seem to be exactly it, but maybe will work: "link":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#qmake-mac-sdk.

          (Z(:^

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            There is also the "-after" flag: "link":http://qt-project.org/doc/qt-4.8/qmake-running.html#makefile-mode-options.

            (Z(:^

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jakob Schou
              wrote on last edited by
              #6

              Thank you for all the suggestions :-) - unfortunately none of them seems to do the trick. Except possibly the option of including mkspec in the repo. Can I tell Qt to look in an alternative place (the repo) for the mkspec?

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                Yes, qmake -spec accepts absolute paths. I have not tried relative ones, but it's worth a try.

                (Z(:^

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  Jakob Schou
                  wrote on last edited by
                  #8

                  Ok, this would be a workable solution. Thanks. Still a bit frustrating that there is no way to simply override the option.

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

                    @
                    QMAKE_CXXFLAGS -= -mmacosx-version-min=10.5
                    QMAKE_CXXFLAGS += -mmacosx-version-min=10.6
                    @

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      Jakob Schou
                      wrote on last edited by
                      #10

                      doesn't work

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

                        What Qt version are you using?
                        @

                        cat test.pro
                        message($$QMAKE_CXXFLAGS)
                        QMAKE_CXXFLAGS -= -mmacosx-version-min=10.6
                        message($$QMAKE_CXXFLAGS)

                        qmake -spec macx-g++
                        Project MESSAGE: -pipe -mmacosx-version-min=10.6
                        Project MESSAGE: -pipe
                        @

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          Jakob Schou
                          wrote on last edited by
                          #12

                          I'm using qt 4.8.3. If I run your test.pro I get:

                          Project MESSAGE: -pipe
                          Project MESSAGE: -pipe

                          The reason seems to be that the flags are added after the pro file is processed. (Which is also why manipulating QMAKE_CXXFLAGS doesn't work.)

                          It is interesting that you have a different (and much more desireable) behaviour. What Qt version are you running?

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

                            I'm using Qt 5. Unfortunately I have no access to a Mac right now to test.

                            In a next step you could <code>qmake -d</code> to see where the flag actually comes from; it should have been already set when processing the <code>.pro</code> file (and thus beeing removable).

                            1 Reply Last reply
                            0
                            • J Offline
                              J Offline
                              Jakob Schou
                              wrote on last edited by
                              #14

                              Ok, qmake -d shows that tge macx-g++ spec sets it to QMAKE_CXXFLAGS_X86_64. Changing this variable in the pro file actually works. I cannot get rid of the -mmacosx-version-min=10.5 from the spec, but now my setting -mmacosx-version-min=10.6 appears last and gets effect.

                              Thanks.

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                diro
                                wrote on last edited by
                                #15

                                The proper way should is to overwrite the QMAKE_MACOSX_DEPLOYMENT_TARGET flags, for example:

                                QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7

                                and then it will change the mmacosx-version-min to 10.7

                                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