Skip to content

Commit

Permalink
Require CMake 3.10 and use CMAKE_CXX_STANDARD
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
leoetlino committed May 4, 2019
1 parent ab9ece9 commit 9133e8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions Source/Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ android {
externalNativeBuild {
cmake {
path "../../../CMakeLists.txt"
version "3.10.2"
}
}

Expand Down
18 changes: 3 additions & 15 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 9133e8f

Please sign in to comment.