gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 42/256: cmake: enable picky compiler options with c


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 42/256: cmake: enable picky compiler options with clang and gcc
Date: Fri, 06 Oct 2017 19:42:13 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit b93954261dfb45a0d4016cda2e02abdf5ba55a6c
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Aug 17 15:55:38 2017 +0200

    cmake: enable picky compiler options with clang and gcc
    
    closes #1799
---
 CMakeLists.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e70afd6c8..50ff5adbf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ set(CMAKE_MODULE_PATH 
"${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
 include(Utilities)
 include(Macros)
 include(CMakeDependentOption)
+include(CheckCCompilerFlag)
 
 project( CURL C )
 
@@ -73,6 +74,7 @@ include_directories(${PROJECT_BINARY_DIR}/include/curl)
 include_directories( ${CURL_SOURCE_DIR}/include )
 
 option(CURL_WERROR "Turn compiler warnings into errors" OFF)
+option(PICKY_COMPILER "Enable picky compiler options" ON)
 option(BUILD_CURL_EXE "Set to ON to build curl executable." ON)
 option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF)
 option(ENABLE_ARES "Set to ON to enable c-ares support" OFF)
@@ -88,6 +90,19 @@ 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_COMPILER_IS_CLANG)
+  if (PICKY_COMPILER)
+    foreach (_CCOPT -pedantic -Wall -W -Wpointer-arith -Wwrite-strings 
-Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations 
-Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare 
-Wundef -Wno-format-nonliteral -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 -Wno-sign-conversion -W [...]
+      # surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each 
new
+      # test result in.
+      CHECK_C_COMPILER_FLAG(${_CCOPT} OPT${_CCOPT})
+      if(OPT${_CCOPT})
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}")
+      endif()
+    endforeach()
+  endif(PICKY_COMPILER)
+endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
+
 if (ENABLE_DEBUG)
   # DEBUGBUILD will be defined only for Debug builds
   if(NOT CMAKE_VERSION VERSION_LESS 3.0)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]