From 6302ab03d8cdba72be369db46cbd728940e77157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=BCttner?= Date: Sun, 14 Aug 2022 22:17:42 +0200 Subject: [PATCH] Set required C++ standard depending on Qt version (#444) Qt6 requires C++17 for building. ADS however only requires C++14 so far. Now when building using Conon for example the packages are built independently and ADS is built using the C++-14 flag which in turn causes the included Qt6 headers to fail the compile process. This patch bumps the required C++ standard to C++17 for builds targeting Qt6 only. --- src/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dea76a0..555551f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,8 +70,6 @@ target_link_libraries(qtadvanceddocking PUBLIC Qt${QT_VERSION_MAJOR}::Core set_target_properties(qtadvanceddocking PROPERTIES AUTOMOC ON AUTORCC ON - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF VERSION ${VERSION_SHORT} EXPORT_NAME "qtadvanceddocking" @@ -79,6 +77,16 @@ set_target_properties(qtadvanceddocking PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" ) +if(QT_VERSION_MAJOR STREQUAL "5") + set_target_properties(qtadvanceddocking PROPERTIES + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON) +elseif(QT_VERSION_MAJOR STREQUAL "6") + set_target_properties(qtadvanceddocking PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON) +endif() + include(CMakePackageConfigHelpers) write_basic_package_version_file( "qtadvanceddockingConfigVersion.cmake"