CMake: C is a bad programming language
Vicki Pfau vi@endrift.com
Fri, 26 Feb 2021 00:42:41 -0800
1 files changed,
4 insertions(+),
4 deletions(-)
jump to
M
CMakeLists.txt
→
CMakeLists.txt
@@ -20,13 +20,13 @@ set(CMAKE_C_EXTENSIONS ON)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.3") set(CMAKE_C_EXTENSIONS ON) endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-missing-field-initializers") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-field-initializers") + set(WARNING_FLAGS "-Wall -Wextra -Wno-missing-field-initializers") if(WIN32) # mingw32 likes to complain about using the "wrong" format strings despite them actually working - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format") + set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-format") endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=implicit-function-declaration") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}") else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146 /wd4267") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146 /wd4267")