############################################################################### # ############################################################################### # platform check first then check for environmente. if(WIN32) # visual studio if(MSVC) # C set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /W3 /Wall /Tc /MTd /Zi /Ob0 /Od /RTC1") set(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /W3 /Wall /Tc /MT /O2 /Og /Ob2/GL") set(CMAKE_C_FLAGS_MINSIZEREL "/D NDEBUG /W3 /Wall /Tc /MT /Ox /GL") set(CMAKE_C_FLAGS_RELWITHDEBINFO "/D NDEBUG /W3 /Wall /Tc /MT /ZI /O2 /Ob1 /GL") # C++ set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /W3 /Wall /Tp /MTd /Zi /Ob0 /Od /RTC1") set(CMAKE_CXX_FLAGS_RELEASE "/D NDEBUG /W3 /Wall /Tp /MT /O2 /Og /Ob2 /GL") set(CMAKE_CXX_FLAGS_MINSIZEREL "/D NDEBUG /W3 /Wall /Tp /MT /Ox /GL") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/D NDEBUG /W3 /Wall /Tp /MT /ZI /O2 /Ob1 /GL") #MinGW elseif(MINGW) # C #set(CMAKE_C_FLAGS "-g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") # C++ #set(CMAKE_CXX_FLAGS "-g -DDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") # cygwin environment elseif(CYGWIN) # C set(CMAKE_C_FLAGS "-g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") # C++ set(CMAKE_CXX_FLAGS "-g -DDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") endif(MSVC) elseif(APPLE) MESSAGE(FATAL " There are no flags set for apple") elseif(UNIX) # C set(CMAKE_C_FLAGS "-g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -ansi -std=c99 -DDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") # C++ set(CMAKE_CXX_FLAGS "-g -DDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") else(WIN32) # C set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -ansi -std=c99 -DDEBUG -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_C_FLAGS_RELEASE "-O2 -ansi -std=c99 -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_MINSIZEREL "-O3 -Os -ansi -std=c99 -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fmessage-length=0") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O2 -ansi -std=c99 -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -DNDEBUG -W -Wextra -Wall -Wbad-function-cast -Wcomments -Wunused-macros -Wendif-labels -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement -fprofile-arcs -ftest-coverage -fmessage-length=0") # C++ set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 -Os -DNDEBUG -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fmessage-length=0") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O2 -DNDEBUG -mfpu=vfp -mthumb -mcpu=cortex-m3 -MD -nostartfiles -W -Wextra -Wall -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage -fmessage-length=0") endif(WIN32)