cmake: always enable warnings without -Werror
Warnings are useful, let's enable them by default.
This commit is contained in:
parent
a909eb6b23
commit
f4b2a4ab00
|
@ -285,12 +285,17 @@ if(HAVE_EPOLL AND HAVE_TIMERFD_CREATE)
|
|||
set(ENABLE_TINY_NGHTTPD 1)
|
||||
endif()
|
||||
|
||||
set(WARNCFLAGS)
|
||||
set(WARNCXXFLAGS)
|
||||
if(ENABLE_WERROR)
|
||||
extract_valid_c_flags(WARNCFLAGS -Werror)
|
||||
extract_valid_c_flags(WARNCXXFLAGS -Werror)
|
||||
endif()
|
||||
if(NOT CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
# For C compiler
|
||||
extract_valid_c_flags(WARNCFLAGS
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
-Wmissing-prototypes
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-declarations
|
||||
|
@ -338,11 +343,11 @@ if(ENABLE_WERROR)
|
|||
extract_valid_cxx_flags(WARNCXXFLAGS
|
||||
# For C++ compiler
|
||||
-Wall
|
||||
-Werror
|
||||
-Wformat-security
|
||||
)
|
||||
endif()
|
||||
|
||||
set(EXTRACFLAG)
|
||||
extract_valid_c_flags(EXTRACFLAG
|
||||
-fvisibility=hidden
|
||||
)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
# Convenience function that checks the availability
|
||||
# of certain C or C++ compiler flags and returns the valid ones.
|
||||
# of certain C or C++ compiler flags and appends valid ones.
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
function(extract_valid_c_flags varname)
|
||||
set(valid_flags "")
|
||||
foreach(flag IN LISTS ARGN)
|
||||
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
|
||||
set(flag_var "C_FLAG_${flag_var}")
|
||||
|
@ -18,7 +17,6 @@ function(extract_valid_c_flags varname)
|
|||
endfunction()
|
||||
|
||||
function(extract_valid_cxx_flags varname)
|
||||
set(valid_flags "")
|
||||
foreach(flag IN LISTS ARGN)
|
||||
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
|
||||
set(flag_var "CXX_FLAG_${flag_var}")
|
||||
|
|
Loading…
Reference in New Issue