diff options
author | Gerald Combs <gerald@zing.org> | 2016-06-25 09:44:28 -0700 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-06-27 04:27:56 +0000 |
commit | 619659599ac199f5f496e050a4cf30c23164cd80 (patch) | |
tree | 3247485e460f61e7e47a026b8cccf3377a756825 | |
parent | a4711f80c6d466cdd7eef376bf911699f55d35eb (diff) | |
download | wireshark-619659599ac199f5f496e050a4cf30c23164cd80.tar.gz wireshark-619659599ac199f5f496e050a4cf30c23164cd80.tar.bz2 wireshark-619659599ac199f5f496e050a4cf30c23164cd80.zip |
CMake: Qt 5.7 requires C++ 11.
Add -std=c++11 to CMAKE_CXX_FLAGS if we have Qt >= 5.7.0 and we're
compiling with g++ or clang++.
Change-Id: Id4ce5921ce5c475e9eb9cc67f94c3b3a895924a1
Reviewed-on: https://code.wireshark.org/review/16135
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 30cf67033a..e8c7bd5a29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -938,6 +938,17 @@ if (Qt5Widgets_FOUND) # list(REMOVE_ITEM Qt5Widgets_EXECUTABLE_COMPILE_FLAGS "-fPIC") endif() + if (Qt5Widgets_VERSION VERSION_GREATER 5.6 + AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")) + # Qt 5.7 and later require C++ 11. If our minmimu required CMake version + # is ever >= 3.1 we can use CXX_STANDARD + CXX_STANDARD_REQUIRED. + message(STATUS "Checking for C++ 11 support (Required by Qt 5.7 and later)") + check_cxx_compiler_flag(-std=c++11 CXX__std_c__11_VALID) + if(NOT CXX__std_c__11_VALID) + message(FATAL_ERROR "Qt ${Qt5Widgets_VERSION} requires C++ 11") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") set (QT_FOUND ON) set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES}) |