Fix -std=c++11 flag

This commit is contained in:
peter 2018-10-24 12:03:07 +08:00
parent 3bb00b7ead
commit 96824f11c6
No known key found for this signature in database
GPG Key ID: BB362E868E2CD2B9
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 2.8.8)
add_definitions(-std=c++11)
if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)

View File

@ -98,6 +98,10 @@ macro(config_compiler_and_linker)
set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
set(cxx_no_exception_flags "-EHs-c- -D_HAS_EXCEPTIONS=0")
set(cxx_no_rtti_flags "-GR-")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(cxx_base_flags "${cxx_base_flags} -Wno-unknown-argument")
endif()
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow -Werror")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)