1#Turn on compilers warnings. 2unix { 3 *g++*{ 4 QMAKE_CXXFLAGS += \ 5 # Key -isystem disable checking errors in system headers. 6 -isystem "$${OUT_PWD}/$${UI_DIR}" \ 7 -isystem "$${OUT_PWD}/$${MOC_DIR}" \ 8 -isystem "$${OUT_PWD}/$${RCC_DIR}" \ 9 $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. 10 11 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 12 QMAKE_CXXFLAGS += -Werror 13 } 14 15 noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer 16 # do nothing 17 } else { 18 CONFIG(debug, debug|release){ 19 # Debug mode 20 #gcc’s 4.8.0 Address Sanitizer 21 #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ 22 QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer 23 QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer 24 QMAKE_LFLAGS += -fsanitize=address 25 } 26 } 27 28 gccUbsan{ # For enable run qmake with CONFIG+=gccUbsan 29 CONFIG(debug, debug|release){ 30 # Debug mode 31 #gcc’s 4.9.0 Undefined Behavior Sanitizer (ubsan) 32 QMAKE_CXXFLAGS += -fsanitize=undefined 33 QMAKE_CFLAGS += -fsanitize=undefined 34 QMAKE_LFLAGS += -fsanitize=undefined 35 } 36 } 37 } 38 39 *clang*{ 40 QMAKE_CXXFLAGS += \ 41 # Key -isystem disable checking errors in system headers. 42 -isystem "$${OUT_PWD}/$${UI_DIR}" \ 43 -isystem "$${OUT_PWD}/$${MOC_DIR}" \ 44 -isystem "$${OUT_PWD}/$${RCC_DIR}" \ 45 $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. 46 47 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 48 QMAKE_CXXFLAGS += -Werror 49 } 50 51 # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and 52 # want them in global list. Compromise decision delete them from local list. 53 QMAKE_CXXFLAGS -= \ 54 -Wundefined-reinterpret-cast \ 55 -Wmissing-prototypes # rcc folder 56 } 57 58 *-icc-*{ 59 QMAKE_CXXFLAGS += \ 60 -isystem "$${OUT_PWD}/$${UI_DIR}" \ 61 -isystem "$${OUT_PWD}/$${MOC_DIR}" \ 62 -isystem "$${OUT_PWD}/$${RCC_DIR}" \ 63 $$ICC_DEBUG_CXXFLAGS 64 65 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 66 QMAKE_CXXFLAGS += -Werror 67 } 68 } 69} else { # Windows 70 *g++*{ 71 QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. 72 73 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 74 QMAKE_CXXFLAGS += -Werror 75 } 76 } 77 78 *msvc*{ 79 QMAKE_CXXFLAGS += $$MSVC_DEBUG_CXXFLAGS # See common.pri for more details. 80 81 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 82 QMAKE_CXXFLAGS += -WX 83 } 84 } 85} 86