From 9133e8f1befbebd87c6e61f0e454f3ae2754285a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Sat, 4 May 2019 23:54:25 +0200 Subject: [PATCH] Require CMake 3.10 and use CMAKE_CXX_STANDARD Removes the need to add -std= flags manually. CMake 3.10 is available in Ubuntu 18.04, which is the oldest LTS version we support. --- CMakeLists.txt | 2 +- Source/Android/app/build.gradle | 1 + Source/CMakeLists.txt | 18 +++--------------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f51b8af77c..5bd5ad7b9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ ######################################## # General setup # -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.10) set(CMAKE_OSX_ARCHITECTURES "x86_64") # Minimum OS X version. # This is inserted into the Info.plist as well. diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index 4139d7c956..f5fe47863f 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -60,6 +60,7 @@ android { externalNativeBuild { cmake { path "../../../CMakeLists.txt" + version "3.10.2" } } diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 2899476e34..7d435e1ca2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -9,21 +9,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") add_definitions(-D_CRT_SECURE_NO_DEPRECATE) endif() -if(CMAKE_C_COMPILER_ID MATCHES "MSVC") - # enable the latest C++ standard feature set, - # and also disable MSVC specific extensions - # to be even more standards compliant. - check_and_add_flag(CPPLATEST /std:c++latest) - check_and_add_flag(STANDARD_COMPLIANCE /permissive-) -else() - # Enable C++17 - # CMAKE_CXX_STANDARD cannot be used because it requires cmake 3.8+. - check_and_add_flag(CXX17 -std=c++17) - if(NOT FLAG_CXX_CXX17) - # Fall back to -std=c++1z - check_and_add_flag(CXX1Z -std=c++1z) - endif() -endif() +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) # These aren't actually needed for C11/C++11 # but some dependencies require them (LLVM, libav).