commit 014c2a2: [Minor] Require cmake 3.0 and modernize somehow
Vsevolod Stakhov
vsevolod at highsecure.ru
Sun Jun 23 08:42:03 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-06-23 09:35:31 +0100
URL: https://github.com/rspamd/rspamd/commit/014c2a2585f1c3aef3f5e6aefeaa5fe0d4310f3e (HEAD -> master)
[Minor] Require cmake 3.0 and modernize somehow
---
CMakeLists.txt | 45 ++++++++++++++++++---------------------------
1 file changed, 18 insertions(+), 27 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33d9cfecd..8838892a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@
#
############################# INITIAL SECTION #############################################
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
PROJECT(rspamd C)
ENABLE_LANGUAGE(ASM)
@@ -711,66 +711,58 @@ IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD99_FLAG)
ENDIF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
IF(SUPPORT_W)
- ADD_DEFINITIONS("-W")
+ ADD_COMPILE_OPTIONS("-W")
ENDIF(SUPPORT_W)
IF(SUPPORT_WALL)
- ADD_DEFINITIONS("-Wall")
+ ADD_COMPILE_OPTIONS("-Wall")
ENDIF(SUPPORT_WALL)
IF(SUPPORT_WPOINTER)
- ADD_DEFINITIONS("-Wpointer-arith")
+ ADD_COMPILE_OPTIONS("-Wpointer-arith")
ENDIF(SUPPORT_WPOINTER)
IF(SUPPORT_WPARAM)
- ADD_DEFINITIONS("-Wno-unused-parameter")
+ ADD_COMPILE_OPTIONS("-Wno-unused-parameter")
ENDIF(SUPPORT_WPARAM)
IF(SUPPORT_WFUNCTION)
- ADD_DEFINITIONS("-Wno-unused-function")
+ ADD_COMPILE_OPTIONS("-Wno-unused-function")
ENDIF(SUPPORT_WFUNCTION)
IF(SUPPORT_WUNUSED_VAR)
- ADD_DEFINITIONS("-Wunused-variable")
+ ADD_COMPILE_OPTIONS("-Wunused-variable")
ENDIF(SUPPORT_WUNUSED_VAR)
IF(SUPPORT_WPOINTER_SIGN)
- ADD_DEFINITIONS("-Wno-pointer-sign")
+ ADD_COMPILE_OPTIONS("-Wno-pointer-sign")
ENDIF(SUPPORT_WPOINTER_SIGN)
IF(SUPPORT_WSTRICT_PROTOTYPES)
- ADD_DEFINITIONS("-Wstrict-prototypes")
+ ADD_COMPILE_OPTIONS("-Wstrict-prototypes")
ENDIF(SUPPORT_WSTRICT_PROTOTYPES)
IF(SUPPORT_WSTRICT_ALIASING)
- ADD_DEFINITIONS("-Wno-strict-aliasing")
- ADD_DEFINITIONS("-fno-strict-aliasing")
+ ADD_COMPILE_OPTIONS("-Wno-strict-aliasing")
+ ADD_COMPILE_OPTIONS("-fno-strict-aliasing")
ENDIF(SUPPORT_WSTRICT_ALIASING)
#IF(SUPPORT_PEDANTIC_FLAG)
# SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -pedantic")
#ENDIF(SUPPORT_PEDANTIC_FLAG)
IF(SUPPORT_WNULL_DEREFERENCE)
- ADD_DEFINITIONS("-Wnull-dereference")
+ ADD_COMPILE_OPTIONS("-Wnull-dereference")
ENDIF()
IF(SUPPORT_WDUPLICATED_COND)
- ADD_DEFINITIONS("-Wduplicated-cond")
+ ADD_COMPILE_OPTIONS("-Wduplicated-cond")
ENDIF()
IF(SUPPORT_WLOGICAL_OP)
- ADD_DEFINITIONS("-Wlogical-op")
+ ADD_COMPILE_OPTIONS("-Wlogical-op")
ENDIF()
IF(SUPPORT_WNO_UNUSED_CONST)
- ADD_DEFINITIONS("-Wno-unused-const-variable")
+ ADD_COMPILE_OPTIONS("-Wno-unused-const-variable")
ENDIF()
IF(SUPPORT_WSIGN_COMPARE)
- ADD_DEFINITIONS("-Wno-sign-compare")
+ ADD_COMPILE_OPTIONS("-Wno-sign-compare")
ENDIF()
-IF(SUPPORT_STD11_FLAG)
- ADD_DEFINITIONS("-std=c11")
-ELSE(SUPPORT_STD11_FLAG)
- MESSAGE("C11 compatible compiler is strongly recommended")
- IF(SUPPORT_STD99_FLAG)
- ADD_DEFINITIONS("-std=c99")
- ENDIF(SUPPORT_STD99_FLAG)
-ENDIF(SUPPORT_STD11_FLAG)
IF(SUPPORT_WIMPLICIT_FALLTHROUGH)
- ADD_DEFINITIONS("-Wno-implicit-fallthrough")
+ ADD_COMPILE_OPTIONS("-Wno-implicit-fallthrough")
ENDIF(SUPPORT_WIMPLICIT_FALLTHROUGH)
CHECK_C_COMPILER_FLAG(-fPIC SUPPORT_FPIC)
IF(SUPPORT_FPIC)
- ADD_DEFINITIONS("-fPIC")
+ ADD_COMPILE_OPTIONS("-fPIC")
ENDIF(SUPPORT_FPIC)
# Optimization flags
@@ -1243,7 +1235,6 @@ ADD_SUBDIRECTORY(utils)
CONFIGURE_FILE(config.h.in src/config.h)
-ADD_DEFINITIONS("HAVE_CONFIG_H")
##################### INSTALLATION ##########################################
More information about the Commits
mailing list