From 4c199efbac791f661ee349471ad8798fe99d3f53 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 16 Apr 2021 16:38:31 -0700 Subject: [PATCH] Add CMake version guard around setting C++ standard It seems like CMake 3.1.3 introduced the C/C++ standard properties, while the minimum version of this CMake file is 2.8.12. So we do what FAudio does, which is print a warning if the CMake version is too old and otherwise use it if we have the feature. --- desktop_version/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desktop_version/CMakeLists.txt b/desktop_version/CMakeLists.txt index c66d2e9d..7bdb96ce 100644 --- a/desktop_version/CMakeLists.txt +++ b/desktop_version/CMakeLists.txt @@ -28,9 +28,12 @@ if(MAKEANDPLAY) add_definitions(-DMAKEANDPLAY) endif() -# Set C++ standard to C++98/C++03 -set(CMAKE_CXX_STANDARD 98) -set(CMAKE_CXX_EXTENSIONS OFF) # prevent mixing stdlib implementations (dangerous!) +if(${CMAKE_VERSION} VERSION_LESS "3.1.3") + message(WARNING "Your CMake version is too old; set -std=c++98 yourself!") +else() + set(CMAKE_CXX_STANDARD 98) + set(CMAKE_CXX_EXTENSIONS OFF) +endif() # Architecture Flags if(APPLE)