Merge pull request #81 from d1vanov/master

Add C++11 support checking and compiler switches when building with Qt >= 5.7
This commit is contained in:
Frank Osterfeld 2016-08-08 10:26:40 +02:00 committed by GitHub
commit d388400c05
1 changed files with 18 additions and 0 deletions

View File

@ -66,6 +66,24 @@ if (Qt5Core_FOUND)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
endif()
if (NOT Qt5Core_VERSION VERSION_LESS "5.7.0")
if (CMAKE_COMPILER_IS_GNUCXX)
if ((NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.0"))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0")
message(FATAL_ERROR "Can't build QtKeychain using g++-${CMAKE_CXX_COMPILER_VERSION} and Qt ${Qt5Core_VERSION}: compiler supporting C++11 is required")
endif()
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "Can't build QtKeychain using clang++-${CMAKE_CXX_COMPILER_VERSION} and Qt ${Qt5Core_VERSION}: compiler supporting C++11 is required")
endif()
elseif ((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND (MSVC_VERSION LESS 1700))
message(FATAL_ERROR "Can't build QtKeychain using VC++-${MSVC_VERSION} and Qt ${Qt5Core_VERSION}: compiler supporting C++11 is required")
endif()
endif()
else()
set(QTKEYCHAIN_VERSION_INFIX "")
if(UNIX AND NOT APPLE)