I'm using qmake
and Visual Studio. In release build qmake adds /GL and /O2 flags to all projects, and I need to remove those two flags for certain libraries within my whole Qt project. Is there a way?
I had a similar problem and I solved it by adding the following directive in the .pro file:
QMAKE_CXXFLAGS_RELEASE -= -g
Observe the _RELEASE suffix, otherwise don't work.
If -=
does not work
try in your .pro file
QMAKE_CFLAGS = $$replace(QMAKE_CFLAGS, "-GL ", "")
QMAKE_CFLAGS = $$replace(QMAKE_CFLAGS, "-O2 ", "")
I edited my .pro file by using this, and it worked!
QMAKE_CXXFLAGS_RELEASE -= -Zc:strictStrings
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
It does not work:
QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings
You can try:
QMAKE_CXXFLAGS_RELEASE -= -GL -O2
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -GL -O2
Take a look in:
your Qt dir\compiler\mkspecs\win32-msvc2013\qmake.conf
The only way this could work is
QMAKE_CFLAGS -= /GL /O2
but I doubt this works for QMAKE_CFLAGS
.
Alternatively, you could redefine QMAKE_CFLAGS
, forgetting its previous value:
QMAKE_CFLAGS = $$CFLAGS_WITHOUT_GL_O2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With