From b28e998a84721f1334b58105516de0bb16c71eeb Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Thu, 29 Sep 2016 14:11:30 -0400 Subject: [PATCH] Allow CPP_STANDARD to be overridden --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8da424..2cf93d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,6 +274,10 @@ if(WIN32) endif(WIN32) # end readline stuff +if( NOT CPP_STANDARD ) + set( CPP_STANDARD, "-std=c++11" ) +endif() + IF(WIN32) target_compile_definitions(fc PUBLIC WIN32 NOMINMAX _WIN32_WINNT=0x0501 _CRT_SECURE_NO_WARNINGS _SCL_SERCURE_NO_WARNINGS @@ -295,12 +299,12 @@ ELSE() SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall") IF(APPLE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wall") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD} -stdlib=libc++ -Wall") ELSE() if( NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) - target_compile_options(fc PUBLIC -std=c++11 -Wall -fnon-call-exceptions) + target_compile_options(fc PUBLIC ${CPP_STANDARD} -Wall -fnon-call-exceptions) endif() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fnon-call-exceptions") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD} -Wall -fnon-call-exceptions") ENDIF() ENDIF()