diff options
author | James E. King, III <jim.king@simplivity.com> | 2017-04-04 13:04:29 -0400 |
---|---|---|
committer | James E. King, III <jking@apache.org> | 2017-04-05 08:58:38 -0400 |
commit | 43e959bc5c4e68d0c2545a09ad4fc1c226885a22 (patch) | |
tree | 98657bcdad212f03ad340eb22890b1fc584aa51f /build/cmake/DefineCMakeDefaults.cmake | |
parent | 7f5a8c28bc58011abef0cede10915c2071efbe41 (diff) | |
download | thrift-43e959bc5c4e68d0c2545a09ad4fc1c226885a22.tar.gz |
THRIFT-4165: better cmake support for C++ language level selection; fixed compiler warnings
This closes #1236
Diffstat (limited to 'build/cmake/DefineCMakeDefaults.cmake')
-rw-r--r-- | build/cmake/DefineCMakeDefaults.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/build/cmake/DefineCMakeDefaults.cmake b/build/cmake/DefineCMakeDefaults.cmake index 7073e8ef8..365c0a434 100644 --- a/build/cmake/DefineCMakeDefaults.cmake +++ b/build/cmake/DefineCMakeDefaults.cmake @@ -68,3 +68,20 @@ set(CMAKE_MACOSX_RPATH TRUE) # locations and running the executables without LD_PRELOAD or similar. # This requires the library to be built with rpath support. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + +# +# C++ Language Level Defaults +# +if (NOT DEFINED CMAKE_CXX_STANDARD) + 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 +endif() + +if (NOT DEFINED CMAKE_CXX_EXTENSIONS) + set(CMAKE_CXX_EXTENSIONS OFF) # use standards compliant language level for portability +endif() |