November 23, 2011

dracheschreck dracheschreck
Lab Rat
6 posts

QMAKE_CXXFLAGS overriden ?

 

Hi!

I’m attempting to add this flag to the compiler so that my project, doesn’t spew out hundreds of “ignoring #pragma warning” messages.

  1. QMAKE_CXXFLAGS += -Wno-unknown-pragmas

Please, refrain from telling me to fix the warnings, since they are in the OpenNI libraries which I am using and do not intend to modify.

I noticed that qmake correctly sets this flag in my makefile, like this:

  1. CXXFLAGS      = -m64 -pipe -Wno-unknown-pragmas -g -Wall -W -D_REENTRANT $(DEFINES)

The problem is that qmake is setting some other flags AFTER my flag, and probably one of them overrides mine. (probably -Wall?)

I tested this by just putting my flag at the end of the line:

  1. CXXFLAGS      = -m64 -pipe -g -Wall -W -D_REENTRANT $(DEFINES) -Wno-unknown-pragmas

after running make, the warnings dissapeared as desired!

Do you know why Qt Creator / qmake / ? is setting this -Wall flag? How can I avoid that this flag is set, or how can I make it so that my flag has higher priority? (i.e, be the last flag on the line)?

Thanks for your help

2 replies

November 23, 2011

Hostel Hostel
Lab Rat
188 posts

Interesting situation. I checked this link:
http://doc.qt.nokia.com/latest/qmake-variable-reference.html
and googled a little. This will help you:

  1.     QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas

November 23, 2011

dracheschreck dracheschreck
Lab Rat
6 posts

Perfect! Thanks!

 
  ‹‹ [resolved] adding boost libraries to paths...?      Pattern recognition tools ››

You must log in to post a reply. Not a member yet? Register here!