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.
This commit is contained in:
Sebastian Büttner 2022-08-14 22:17:42 +02:00 committed by GitHub
parent 2afca346b0
commit 6302ab03d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,8 +70,6 @@ target_link_libraries(qtadvanceddocking PUBLIC Qt${QT_VERSION_MAJOR}::Core
set_target_properties(qtadvanceddocking PROPERTIES set_target_properties(qtadvanceddocking PROPERTIES
AUTOMOC ON AUTOMOC ON
AUTORCC ON AUTORCC ON
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
VERSION ${VERSION_SHORT} VERSION ${VERSION_SHORT}
EXPORT_NAME "qtadvanceddocking" EXPORT_NAME "qtadvanceddocking"
@ -79,6 +77,16 @@ set_target_properties(qtadvanceddocking PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" 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) include(CMakePackageConfigHelpers)
write_basic_package_version_file( write_basic_package_version_file(
"qtadvanceddockingConfigVersion.cmake" "qtadvanceddockingConfigVersion.cmake"