From 3800584c2d2062a95e94f64038f16c319c59f609 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Fri, 19 Apr 2019 07:15:18 +0200 Subject: [PATCH] cmake: Set expected C++ standard to C++17 --- CMakeLists.txt | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fad7f41a..29cce814 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # CMake Setup -CMake_Minimum_Required(VERSION 3.1.0) +CMake_Minimum_Required(VERSION 3.8.0) Include("cmake/util.cmake") # Automatic Versioning @@ -133,15 +133,9 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) endif() # C++ Standard and Extensions -IF (CMAKE_VERSION VERSION_LESS "3.8") - SET(CMAKE_CXX_STANDARD 14) -ELSEIF (CMAKE_VERSION VERSION_LESS "3.11") - SET(CMAKE_CXX_STANDARD 17) -ELSE() # CMake 3.11 or higher: - SET(CMAKE_CXX_STANDARD 20) -ENDIF() -## Disable nonstandard extensions -SET(CMAKE_CXX_EXTENSIONS OFF) +## Use C++17 and no non-standard extensions. +SET(_CXX_STANDARD 17) +SET(_CXX_EXTENSIONS OFF) ################################################################################ # Options @@ -472,6 +466,14 @@ if (WIN32) ) endif() +# C++ Standard and Extensions +set_target_properties( + ${PROJECT_NAME} + PROPERTIES + CXX_STANDARD ${_CXX_STANDARD} + CXX_EXTENSIONS ${_CXX_EXTENSIONS} +) + # File Version if(WIN32) set_target_properties(