diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-10-27 16:46:47 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-10-27 17:07:25 +0900 |
commit | 9c6c5ad0a716b0e436ca863efb72bc9ad8057116 (patch) | |
tree | 79aa0cd8de66509bf762bf7d3ca1833909810794 | |
parent | abc47b334efe4f950fa73bec8fa80d5982e337b4 (diff) | |
download | libquotient-9c6c5ad0a716b0e436ca863efb72bc9ad8057116.tar.gz libquotient-9c6c5ad0a716b0e436ca863efb72bc9ad8057116.zip |
Set CMAKE_CXX_STANDARD variable instead of listing compiler features
That list was bound to become outdated every now and then.
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index eea2f5dd..eff5653d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,15 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) "MinSizeRel" "RelWithDebInfo") endif() +if ( CMAKE_VERSION VERSION_LESS "3.1" ) + CHECK_CXX_COMPILER_FLAG("-std=c++11" STD_FLAG_SUPPORTED) + if ( STD_FLAG_SUPPORTED ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif ( STD_FLAG_SUPPORTED ) +else ( CMAKE_VERSION VERSION_LESS "3.1" ) + set(CMAKE_CXX_STANDARD 11) +endif ( CMAKE_VERSION VERSION_LESS "3.1" ) + find_package(Qt5 5.2.1 REQUIRED Network Gui) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) @@ -26,11 +35,11 @@ message( STATUS ) message( STATUS "=============================================================================" ) message( STATUS " libqmatrixclient Build Information" ) message( STATUS "=============================================================================" ) -message( STATUS "Building with: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) if (CMAKE_BUILD_TYPE) message( STATUS "Build type: ${CMAKE_BUILD_TYPE}") endif(CMAKE_BUILD_TYPE) -message( STATUS "Building with Qt ${Qt5_VERSION} at: ${Qt5_Prefix}" ) +message( STATUS "Using compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}" ) +message( STATUS "Using Qt ${Qt5_VERSION} at: ${Qt5_Prefix}" ) message( STATUS "=============================================================================" ) message( STATUS ) @@ -70,20 +79,4 @@ add_library(qmatrixclient ${libqmatrixclient_SRCS}) set_property(TARGET qmatrixclient PROPERTY VERSION "0.0.0") set_property(TARGET qmatrixclient PROPERTY SOVERSION 0 ) -if ( CMAKE_VERSION VERSION_LESS "3.1" ) - CHECK_CXX_COMPILER_FLAG("-std=c++11" STD_FLAG_SUPPORTED) - if ( STD_FLAG_SUPPORTED ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif ( STD_FLAG_SUPPORTED ) -else ( CMAKE_VERSION VERSION_LESS "3.1" ) - target_compile_features(qmatrixclient PRIVATE cxx_range_for) - target_compile_features(qmatrixclient PRIVATE cxx_override) - target_compile_features(qmatrixclient PRIVATE cxx_strong_enums) - target_compile_features(qmatrixclient PRIVATE cxx_lambdas) - target_compile_features(qmatrixclient PRIVATE cxx_auto_type) - target_compile_features(qmatrixclient PRIVATE cxx_generalized_initializers) - target_compile_features(qmatrixclient PRIVATE cxx_nullptr) - target_compile_features(qmatrixclient PRIVATE cxx_variadic_templates) -endif ( CMAKE_VERSION VERSION_LESS "3.1" ) - target_link_libraries(qmatrixclient Qt5::Core Qt5::Network Qt5::Gui) |