From 1d67a3dcf33998dd4650c5f02f7ba5812f1b4be5 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 14 Dec 2021 18:45:11 +0100 Subject: [PATCH] Require C++14 --- CMakeLists.txt | 4 ++-- doc/21-development.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a613afb1a..bfe8591ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8.8) set(BOOST_MIN_VERSION "1.66.0") +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) project(icinga2) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -395,8 +397,6 @@ if(MSVC) endif() if(NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - 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) diff --git a/doc/21-development.md b/doc/21-development.md index e0a9f6b57..93da140f1 100644 --- a/doc/21-development.md +++ b/doc/21-development.md @@ -697,7 +697,7 @@ Read more about it in the [Technical Concepts](19-technical-concepts.md#technica #### Get to know the code -First off, you really need to know C++ and portions of C++11 and the boost libraries. +First off, you really need to know C++ and portions of C++14 and the boost libraries. Best is to start with a book or online tutorial to get into the basics. Icinga developers gained their knowledge through studies, training and self-teaching code by trying it out and asking senior developers for guidance. @@ -1138,7 +1138,7 @@ for formatting, splitting strings, joining arrays into strings, etc. Use the existing libraries and header-only includes for this specific version. -Note: Prefer C++11 features where possible, e.g. std::atomic and lambda functions. +Note: Prefer C++14 features where possible, e.g. std::atomic and lambda functions. General: @@ -1185,7 +1185,7 @@ If you consider an external library or code to be included with Icinga, the foll requirements must be fulfilled: - License is compatible with GPLv2+. Boost license, MIT works, Apache is not. -- C++11 is supported, C++14 or later doesn't work +- C++14 is supported - Header only implementations are preferred, external libraries require packages on every distribution. - No additional frameworks, Boost is the only allowed. - The code is proven to be robust and the GitHub repository is alive, or has 1k+ stars. Good libraries also provide a user list, if e.g. Ceph is using it, this is a good candidate. @@ -2172,7 +2172,7 @@ Icinga application using a dist tarball (including notes for distributions): * cmake >= 2.6 * GNU make (make) or ninja-build -* C++ compiler which supports C++11 +* C++ compiler which supports C++14 * RHEL/Fedora/SUSE: gcc-c++ >= 6.3 (extra Developer Tools on RHEL7 see below) * Debian/Ubuntu: build-essential * Alpine: build-base