Make function calls without prior declaration an error
which is the default behavior on C99 and up.
This commit is contained in:
parent
c2ec88f930
commit
8be93762d9
2 changed files with 12 additions and 5 deletions
14
CMakeLists.txt
Normal file → Executable file
14
CMakeLists.txt
Normal file → Executable file
|
@ -12,10 +12,16 @@ else()
|
|||
set (CMAKE_C_STANDARD 99)
|
||||
endif()
|
||||
include(CheckCCompilerFlag)
|
||||
CHECK_C_COMPILER_FLAG("-Werror=pointer-arith" COMPILER_HAS_POINTER_ARITH_TOGGLE)
|
||||
if(COMPILER_HAS_POINTER_ARITH_TOGGLE)
|
||||
set(CMAKE_C_FLAGS "-Werror=pointer-arith ${CMAKE_C_FLAGS}")
|
||||
endif()
|
||||
foreach(option -Werror=pointer-arith;-Werror=implicit-function-declaration)
|
||||
CHECK_C_COMPILER_FLAG("${option}" COMPILER_HAS_THOSE_TOGGLES)
|
||||
set(outcome "Failed")
|
||||
if(COMPILER_HAS_THOSE_TOGGLES)
|
||||
set(CMAKE_C_FLAGS "${option} ${CMAKE_C_FLAGS}")
|
||||
set(outcome "works")
|
||||
endif()
|
||||
message(STATUS "Testing if ${option} can be used -- ${outcome}")
|
||||
endforeach()
|
||||
|
||||
|
||||
add_subdirectory(src release)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue