1#Turn on compilers warnings. 2unix { 3 *g++*{ 4 QMAKE_CXXFLAGS += \ 5 # Key -isystem disable checking errors in system headers. 6 -isystem "$${OUT_PWD}/$${MOC_DIR}" \ 7 $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. 8 9 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 10 QMAKE_CXXFLAGS += -Werror 11 } 12 13 noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer 14 # do nothing 15 } else { 16 CONFIG(debug, debug|release){ 17 # Debug mode 18 #gcc’s 4.8.0 Address Sanitizer 19 #http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/ 20 QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer 21 QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer 22 QMAKE_LFLAGS += -fsanitize=address 23 } 24 } 25 26 gccUbsan{ # For enable run qmake with CONFIG+=gccUbsan 27 CONFIG(debug, debug|release){ 28 # Debug mode 29 #gcc’s 4.9.0 Undefined Behavior Sanitizer (ubsan) 30 QMAKE_CXXFLAGS += -fsanitize=undefined 31 QMAKE_CFLAGS += -fsanitize=undefined 32 QMAKE_LFLAGS += -fsanitize=undefined 33 } 34 } 35 } 36 37 *clang*{ 38 QMAKE_CXXFLAGS += \ 39 # Key -isystem disable checking errors in system headers. 40 -isystem "$${OUT_PWD}/$${MOC_DIR}" \ 41 $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. 42 43 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 44 QMAKE_CXXFLAGS += -Werror 45 } 46 } 47 48 *-icc-*{ 49 QMAKE_CXXFLAGS += \ 50 -isystem "$${OUT_PWD}/$${MOC_DIR}" \ 51 $$ICC_DEBUG_CXXFLAGS 52 53 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 54 QMAKE_CXXFLAGS += -Werror 55 } 56 } 57} else { # Windows 58 *g++*{ 59 QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. 60 61 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 62 QMAKE_CXXFLAGS += -Werror 63 } 64 } 65 66 *msvc*{ 67 QMAKE_CXXFLAGS += $$MSVC_DEBUG_CXXFLAGS # See common.pri for more details. 68 69 checkWarnings{ # For enable run qmake with CONFIG+=checkWarnings 70 QMAKE_CXXFLAGS += -WX 71 } 72 } 73} 74