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. [Solved] qmake: Where do additional CXXFLAGS come from?
Forum Updated to NodeBB v4.3 + New Features

[Solved] qmake: Where do additional CXXFLAGS come from?

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 2 Posters 6.4k 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    I am trying to inhibit a certain warning on GCC. For that I added
    @QMAKE_CXXFLAGS += -Wno-switch@

    At the time I append this inhibition, my QMAKE_CXXFLAGS look like this:
    @-pipe@

    However, in the resulting Makefile, my flags look like this:
    @-pipe -Wno-switch -g -fPIC -Wall -W -D_REENTRANT $(DEFINES) @

    Where do the additional flags come from? I assume that the -Wall later on cancels my request to inhibit that single warning (at least, the warning is still displayed). What can I do?

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

      Check out the mkspecs.

      (Z(:^

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        Right on target!

        How do I make my project-specific CXXFLAGS appear after those specified by the mkspecs? Because I do actually want -Wall, except for this one warning.

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

          Uh, now that is trickier. I don't know a good answer to this (but there might be one). The first idea that comes to my mind is to modify the mkspecs: but then you will have to remember to use that specific modified version of mkspecs, especially after changing (upgrade) Qt version. The second idea.. what about that "$(DEFINES)" at the end of compiler call? Maybe you can add your flag to that variable?

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Asperamanca
            wrote on last edited by
            #5

            I found a solution:

            Do this within the project:
            @CONFIG -= warn_on
            QMAKE_CFLAGS += $$QMAKE_CFLAGS_WARN_ON
            QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_WARN_ON
            QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_ON@

            You now still have all warnings, but they are part of the CXXFLAGS. Anything you append will now effectively inhibit warnings.

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

              that is a quite impressive find, thanks for sharing!

              (Z(:^

              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