summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2023-04-16 22:28:25 +0000
committerViktor Szakats <commit@vsz.me>2023-04-16 22:28:25 +0000
commit9c543de0ecf14880c3324d3d24591fb695dd1917 (patch)
tree1e41ac4e14cabc63d0fa4fe35cdf8c1be7e7a4bd /CMakeLists.txt
parent15a361892d43828b01cf245c70ebb98f21a8dc83 (diff)
downloadcurl-9c543de0ecf14880c3324d3d24591fb695dd1917.tar.gz
cmake: speed up and extend picky clang/gcc options
Extend existing picky compiler options with ones missing compared to autotools builds. Also sync options between clang and gcc. Redesign the way we enable these options to avoid the slow option detection almost completely. This reduces the number of detections from 35 to zero for clang and 3 for gcc, even after adding a bunch of new options. clang 3.0 (2011-11-29) and gcc 2.95 (1999-07-31) now required. Also show enabled picky options. Ref: https://github.com/libssh2/libssh2/pull/952 Reviewed-by: Daniel Stenberg Closes #10973
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 1 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 542957455..a0fe76c24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,28 +127,7 @@ cmake_dependent_option(ENABLE_THREADED_RESOLVER "Set to ON to enable threaded DN
option(ENABLE_DEBUG "Set to ON to enable curl debug features" OFF)
option(ENABLE_CURLDEBUG "Set to ON to build with TrackMemory feature enabled" OFF)
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
- if(PICKY_COMPILER)
- foreach(_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wfloat-equal -Wsign-compare -Wundef -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wvla -Wdouble-promotion -Wenum-conversion -Warith-conversion)
- # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new
- # test result in.
- string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname)
- check_c_compiler_flag(${_CCOPT} ${_optvarname})
- if(${_optvarname})
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}")
- endif()
- endforeach()
- foreach(_CCOPT long-long multichar format-nonliteral sign-conversion system-headers pedantic-ms-format)
- # GCC only warns about unknown -Wno- options if there are also other diagnostic messages,
- # so test for the positive form instead
- string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname)
- check_c_compiler_flag("-W${_CCOPT}" ${_optvarname})
- if(${_optvarname})
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-${_CCOPT}")
- endif()
- endforeach()
- endif()
-endif()
+include(PickyWarnings)
if(ENABLE_DEBUG)
# DEBUGBUILD will be defined only for Debug builds