Make C++11 mandatory.

This commit is contained in:
Felix Geyer
2015-07-24 18:28:12 +02:00
parent 0e85c98d02
commit 7fa0eddc5f
112 changed files with 332 additions and 411 deletions

View File

@@ -32,7 +32,6 @@ include(CheckCXXSourceCompiles)
option(WITH_TESTS "Enable building of unit tests" ON)
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF)
option(WITH_CXX11 "Build with the C++ 11 standard" ON)
set(KEEPASSX_VERSION "2.0 beta 2")
set(KEEPASSX_VERSION_NUM "1.9.92")
@@ -115,16 +114,24 @@ if(WITH_LTO)
endif()
endif()
if (WITH_CXX11)
add_gcc_compiler_cxxflags("-std=c++0x")
add_gcc_compiler_cflags("-ansi")
if(APPLE)
add_gcc_compiler_cxxflags("-stdlib=libc++")
endif()
check_cxx_compiler_flag("-std=c++11" CXX11_AVAILABLE)
if (CXX11_AVAILABLE)
add_gcc_compiler_cxxflags("-std=c++11")
else()
add_gcc_compiler_flags("-ansi")
check_cxx_compiler_flag("-std=c++0x" CXX0X_AVAILABLE)
if(CXX0X_AVAILABLE)
add_gcc_compiler_cxxflags("-std=c++0x")
else()
message(FATAL_ERROR "Compiler doesn't support C++11")
endif()
endif()
if(APPLE)
add_gcc_compiler_cxxflags("-stdlib=libc++")
endif()
add_gcc_compiler_cflags("-ansi")
if(MINGW)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)