I want to specify the "treat warnings as errors" flag for all files except one. For example if I have a.cpp, b.cpp and c.cpp, this would do it for all 3:
SOURCES += a.cpp \
b.cpp \
c.cpp
QMAKE_CXXFLAGS += /WX
But how do I do it so that only a.cpp and b.cpp have that flag but c.cpp doesn't? For example I tried this (but it doesn't work):
SOURCES += a.cpp \
b.cpp \
c.cpp
QMAKE_CXXFLAGS += /WX
c.cpp: QMAKE_CXXFLAGS -= /WX
Edit: I see there is How to specify separate compilation options for different targets in qmake? and http://permalink.gmane.org/gmane.comp.lib.qt.general/10945. However I need to unspecify a flag for a certain file (the opposite), so I'm not sure if this works for me. Also the provided solution is for GCC (and I'm not MSVC).
Edit 2: Would it be possible to unset /WX
with a #pragma
from inside the source file itself?