From 2cde6a4d8fd2ab53fbed1c88ff31d494bc50aa82 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Sun, 10 Sep 2023 18:07:44 +0200 Subject: [PATCH] Use C++17 --- CMakeLists.txt | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3e6e535..813cb750 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,26 +38,24 @@ if ( CCACHE_FOUND ) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(CCACHE_FOUND) -# enable C++14; MSVC doesn't have c++14 feature switch -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - if(APPLE) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG("Werror=unguarded-availability" REQUIRED_UNGUARDED_AVAILABILITY) - if(REQUIRED_UNGUARDED_AVAILABILITY) - list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "Werror=unguarded-availability") - endif() +# enable C++17 +if(APPLE) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("Werror=unguarded-availability" REQUIRED_UNGUARDED_AVAILABILITY) + if(REQUIRED_UNGUARDED_AVAILABILITY) + list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "Werror=unguarded-availability") endif() - - if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi") - endif() - - set(CMAKE_CXX_STANDARD 14) - set(CXX_STANDARD_REQUIRED ON) - set(CXX_EXTENSIONS OFF) endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi") +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + # Set build variables # Grabber SET ( DEFAULT_AMLOGIC OFF )