CMakeLists.txt
changeset 10009 8c6b05b0a27e
parent 10004 8f2f519d1e61
child 10012 ed02c7a84612
     1.1 --- a/CMakeLists.txt	Mon Jan 04 22:00:04 2016 -0500
     1.2 +++ b/CMakeLists.txt	Mon Jan 04 22:58:38 2016 -0500
     1.3 @@ -334,6 +334,24 @@
     1.4  
     1.5  # Compiler option evaluation
     1.6  if(USE_GCC OR USE_CLANG)
     1.7 +  # Check for -Wall first, so later things can override pieces of it.
     1.8 +  check_c_compiler_flag(-Wall HAVE_GCC_WALL)
     1.9 +  if(HAVE_GCC_WALL)
    1.10 +    list(APPEND EXTRA_CFLAGS "-Wall")
    1.11 +    if(HAIKU)
    1.12 +      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
    1.13 +    endif()
    1.14 +  endif()
    1.15 +
    1.16 +  check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
    1.17 +  if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
    1.18 +    check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
    1.19 +    if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
    1.20 +      list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement")
    1.21 +    endif()
    1.22 +    list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement")
    1.23 +  endif()
    1.24 +
    1.25    if(DEPENDENCY_TRACKING)
    1.26      check_c_source_compiles("
    1.27          #if !defined(__GNUC__) || __GNUC__ < 3
    1.28 @@ -375,13 +393,6 @@
    1.29    endif()
    1.30    set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
    1.31  
    1.32 -  check_c_compiler_flag(-Wall HAVE_GCC_WALL)
    1.33 -  if(HAVE_GCC_WALL)
    1.34 -    list(APPEND EXTRA_CFLAGS "-Wall")
    1.35 -    if(HAIKU)
    1.36 -      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
    1.37 -    endif()
    1.38 -  endif()
    1.39    check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
    1.40    if(HAVE_GCC_WSHADOW)
    1.41      list(APPEND EXTRA_CFLAGS "-Wshadow")