Index: codec2-dev/CMakeLists.txt =================================================================== --- codec2-dev/CMakeLists.txt (revision 3026) +++ codec2-dev/CMakeLists.txt (working copy) @@ -52,18 +52,21 @@ endif() # Set default C++ flags. -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O3 -std=gnu11") +include(CheckCCompilerFlag) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O3") +CHECK_C_COMPILER_FLAG("-std=gnu11" COMPILER_SUPPORTS_GNU11) +if(COMPILER_SUPPORTS_GNU11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11") +else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") +endif() # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS}") # -fPIC is implied on MinGW... if(NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") endif()