1
0
mirror of https://github.com/Icinga/icinga2.git synced 2025-04-08 17:05:25 +02:00

Merge pull request from Icinga/cxx17

Require GCC 7+ for C++17
This commit is contained in:
Julian Brost 2023-03-31 14:06:55 +02:00 committed by GitHub
commit 41065e30c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

@ -2,9 +2,16 @@
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)
set(CMAKE_CXX_EXTENSIONS OFF)
if("${CMAKE_VERSION}" VERSION_LESS "3.8") # SLES 12.5
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
endif()
else()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
project(icinga2)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -386,8 +393,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
OUTPUT_VARIABLE _ICINGA2_COMPILER_VERSION
)
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "6.3.0")
message(FATAL_ERROR "Your version of GCC (${CMAKE_CXX_COMPILER_VERSION}) is too old for building Icinga 2 (GCC >= 6.3.0 is required).")
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "7.0.0")
message(FATAL_ERROR "Your version of GCC (${CMAKE_CXX_COMPILER_VERSION}) is too old for building Icinga 2 (GCC >= 7.0.0 is required).")
endif()
endif()

@ -697,7 +697,7 @@ Read more about it in the [Technical Concepts](19-technical-concepts.md#technica
#### Get to know the code <a id="development-develop-get-to-know-the-code"></a>
First off, you really need to know C++ and portions of C++14 and the boost libraries.
First off, you really need to know C++ and portions of C++17 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++14 features where possible, e.g. std::atomic and lambda functions.
Note: Prefer C++17 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++14 is supported
- C++17 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.
@ -2169,8 +2169,8 @@ Icinga application using a dist tarball (including notes for distributions):
* cmake >= 2.6
* GNU make (make) or ninja-build
* C++ compiler which supports C++14
* RHEL/Fedora/SUSE: gcc-c++ >= 6.3 (extra Developer Tools on RHEL7 see below)
* C++ compiler which supports C++17
* RHEL/Fedora/SUSE: gcc-c++ >= 7 (extra Developer Tools on RHEL7 see below)
* Debian/Ubuntu: build-essential
* Alpine: build-base
* you can also use clang++
@ -2442,7 +2442,7 @@ The following packages are required to build the SELinux policy module:
##### RHEL/CentOS 7
The RedHat Developer Toolset is required for building Icinga 2 beforehand.
This contains a C++ compiler which supports C++14 features.
This contains a C++ compiler which supports C++17 features.
```bash
yum install centos-release-scl