[icinga-checkins] icinga.org: icinga2/master: Update cmake config to require a compiler that supports C++11

git at icinga.org git at icinga.org
Thu Aug 25 07:10:54 CEST 2016


Module: icinga2
Branch: master
Commit: bdaf02295fccfe17f7816598ee4bd4fb71ba1658
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=bdaf02295fccfe17f7816598ee4bd4fb71ba1658

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Aug 25 05:14:13 2016 +0200

Update cmake config to require a compiler that supports C++11

fixes #12537

---

 CMakeLists.txt |   39 ++++++++++-----------------------------
 1 file changed, 10 insertions(+), 29 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8921b20..4902627 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -235,42 +235,23 @@ if(HAVE_LIBEXECINFO)
   set(HAVE_BACKTRACE_SYMBOLS TRUE)
 endif()
 
-set(_ICINGA2_CXX11 OFF)
+include(CheckCXXCompilerFlag)
 
-if(UNIX)
-  include(CheckCXXCompilerFlag)
-  check_cxx_compiler_flag("-std=c++11" CXX_FLAG_CXX11)
-
-  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-    exec_program(${CMAKE_CXX_COMPILER}
-      ARGS -dumpversion
-      OUTPUT_VARIABLE _ICINGA2_COMPILER_VERSION
-    )
-
-    if("${_ICINGA2_COMPILER_VERSION}" VERSION_LESS "4.7.0")
-      message(STATUS "Your version of GCC is too old for building Icinga 2 in C++11 mode.")
-      set(CXX_FLAG_CXX11 OFF)
-    endif()
-  endif()
-
-  if(CXX_FLAG_CXX11)
-    set(_ICINGA2_CXX11 ON)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-  endif()
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  exec_program(${CMAKE_CXX_COMPILER}
+    ARGS -dumpversion
+    OUTPUT_VARIABLE _ICINGA2_COMPILER_VERSION
+  )
 
-  check_cxx_compiler_flag("-Wno-inconsistent-missing-override" CXX_FLAG_NO_OVERRIDE_WARNING)
-  if(CXX_FLAG_NO_OVERRIDE_WARNING)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
+  if("${_ICINGA2_COMPILER_VERSION}" VERSION_LESS "4.6.0")
+    message(FATAL_ERRORSTATUS "Your version of GCC is too old for building Icinga 2 (GCC >= 4.6.0 is required).")
   endif()
 endif()
 
 if(NOT MSVC)
-  set(CXX_FEATURE_OVERRIDE OFF)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 
-  if(_ICINGA2_CXX11)
-    include(CheckCXXSourceCompiles)
-    check_cxx_source_compiles("class Base { public: virtual void test(void) { } }; class Derived : public Base { virtual void test(void) override { } }; int main(){}" CXX_FEATURE_OVERRIDE)
-  endif()
+  check_cxx_source_compiles("class Base { public: virtual void test(void) { } }; class Derived : public Base { virtual void test(void) override { } }; int main(){}" CXX_FEATURE_OVERRIDE)
 
   if(NOT CXX_FEATURE_OVERRIDE)
     add_definitions("-Doverride=")



More information about the icinga-checkins mailing list