This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
commit 5e16f8b9086ce9bf4fa74993ecc51a7b9354f51e Author: cyy <cyye...@outlook.com> AuthorDate: Sun Jan 6 10:49:20 2019 +0800 set c++11 in proper place --- build/cmake/DefineCMakeDefaults.cmake | 17 +++++++---------- build/cmake/DefinePlatformSpecifc.cmake | 11 ----------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/build/cmake/DefineCMakeDefaults.cmake b/build/cmake/DefineCMakeDefaults.cmake index 65ccc69..93255e0 100644 --- a/build/cmake/DefineCMakeDefaults.cmake +++ b/build/cmake/DefineCMakeDefaults.cmake @@ -73,19 +73,16 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # C++ Language Level Defaults - this depends on the compiler capabilities # if (NOT DEFINED CMAKE_CXX_STANDARD) - if (MSVC AND MSVC_VERSION LESS 1800) - # MSVC 2012 and earlier don't support template aliases so you have to use C++98 - set(CMAKE_CXX_STANDARD 98) - message(STATUS "Setting C++98 as the default language level (for an older MSVC compiler).") - else() - set(CMAKE_CXX_STANDARD 11) # C++11 - message(STATUS "Setting C++11 as the default language level.") - endif() + set(CMAKE_CXX_STANDARD 11) # C++11 + message(STATUS "Setting C++11 as the default language level.") message(STATUS "To specify a different C++ language level, set CMAKE_CXX_STANDARD") endif() -if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) - set(CMAKE_CXX_STANDARD_REQUIRED OFF) # can degrade to C++98 if compiler does not support C++11 +if (CMAKE_CXX_STANDARD EQUAL 98) + message(FATAL_ERROR "only C++11 or above C++ standard is supported") +elseif (CMAKE_CXX_STANDARD EQUAL 11) + # should not fallback to C++98 + set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() if (NOT DEFINED CMAKE_CXX_EXTENSIONS) diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake index 98fb589..3f112b6 100644 --- a/build/cmake/DefinePlatformSpecifc.cmake +++ b/build/cmake/DefinePlatformSpecifc.cmake @@ -95,17 +95,6 @@ if(WITH_STDTHREADS) endif() # C++ Language Level -if (NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) -elseif (CMAKE_CXX_STANDARD EQUAL 98) - message(FATAL_ERROR "only C++11 or above C++ standard is supported") -endif() - -if (CMAKE_CXX_STANDARD EQUAL 11) - # should not fallback to C++98 - set(CMAKE_CXX_STANDARD_REQUIRED ON) -endif() - set(CXX_LANGUAGE_LEVEL "C++${CMAKE_CXX_STANDARD}") if (CMAKE_CXX_STANDARD_REQUIRED) string(CONCAT CXX_LANGUAGE_LEVEL "${CXX_LANGUAGE_LEVEL} [compiler must support it]")