From 56e762c56333906e585fd662d8717868235e2432 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 21 Dec 2021 20:10:11 +0100 Subject: [PATCH] Make it compile against qt6 --- CMakeLists.txt | 8 ++++---- autotests/CMakeLists.txt | 14 +++++++------- src/imageformats/CMakeLists.txt | 6 +++--- tests/CMakeLists.txt | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22a957b..d6af58a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ include(CheckIncludeFiles) include(FindPkgConfig) set(REQUIRED_QT_VERSION 5.15.2) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) +find_package(Qt${QT_MAJOR_VERSION}Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) find_package(KF5Archive) set_package_properties(KF5Archive PROPERTIES @@ -32,12 +32,12 @@ set_package_properties(KF5Archive PROPERTIES # this available in PATH set(BUILD_EPS_PLUGIN FALSE) if (UNIX) - find_package(Qt5PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE) - set_package_properties(Qt5PrintSupport PROPERTIES + find_package(Qt${QT_MAJOR_VERSION}PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE) + set_package_properties(Qt${QT_MAJOR_VERSION}PrintSupport PROPERTIES PURPOSE "Required for the QImage plugin for EPS images" TYPE OPTIONAL ) - if (Qt5PrintSupport_FOUND) + if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport) set(BUILD_EPS_PLUGIN TRUE) endif() endif() diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 39fb28f..0b7d40d 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -15,7 +15,7 @@ macro(kimageformats_read_tests) if (NOT TARGET readtest) add_executable(readtest readtest.cpp) - target_link_libraries(readtest Qt5::Gui) + target_link_libraries(readtest Qt${QT_MAJOR_VERSION}::Gui) target_compile_definitions(readtest PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read") ecm_mark_as_test(readtest) @@ -32,7 +32,7 @@ endmacro() macro(kimageformats_write_tests) if (NOT TARGET writetest) add_executable(writetest writetest.cpp) - target_link_libraries(writetest Qt5::Gui) + target_link_libraries(writetest Qt${QT_MAJOR_VERSION}::Gui) target_compile_definitions(writetest PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write") ecm_mark_as_test(writetest) @@ -117,19 +117,19 @@ if (OpenEXR_FOUND) # FIXME: OpenEXR tests endif() -find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET) +find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET) -if(NOT Qt5Test_FOUND) - message(STATUS "Qt5Test not found, some autotests will not be built.") +if(NOT TARGET Qt${QT_MAJOR_VERSION}Test) + message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, some autotests will not be built.") return() endif() add_executable(pictest pictest.cpp) -target_link_libraries(pictest Qt5::Gui Qt5::Test) +target_link_libraries(pictest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test) ecm_mark_as_test(pictest) add_test(NAME kimageformats-pic COMMAND pictest) add_executable(anitest anitest.cpp) -target_link_libraries(anitest Qt5::Gui Qt5::Test) +target_link_libraries(anitest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test) ecm_mark_as_test(anitest) add_test(NAME kimageformats-ani COMMAND anitest) diff --git a/src/imageformats/CMakeLists.txt b/src/imageformats/CMakeLists.txt index 79570c1..b9bc9db 100644 --- a/src/imageformats/CMakeLists.txt +++ b/src/imageformats/CMakeLists.txt @@ -12,7 +12,7 @@ function(kimageformats_add_plugin plugin) add_library(${plugin} MODULE ${KIF_ADD_PLUGIN_SOURCES}) set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats") - target_link_libraries(${plugin} Qt5::Gui) + target_link_libraries(${plugin} Qt${QT_MAJOR_VERSION}::Gui) install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats) endfunction() @@ -36,9 +36,9 @@ install(FILES dds-qt.desktop RENAME dds.desktop DESTINATION ${KDE_INSTALL_KSERVI ################################## if (BUILD_EPS_PLUGIN) - if (Qt5PrintSupport_FOUND) + if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport) kimageformats_add_plugin(kimg_eps SOURCES eps.cpp) - target_link_libraries(kimg_eps Qt5::PrintSupport) + target_link_libraries(kimg_eps Qt${QT_MAJOR_VERSION}::PrintSupport) install(FILES eps.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/qimageioplugins/) endif() endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 792c0e3..19fe01f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,7 +5,7 @@ include(ECMMarkAsTest) macro(kimageformats_executable_tests) foreach(_testname ${ARGN}) add_executable(${_testname} ${_testname}.cpp) - target_link_libraries(${_testname} Qt5::Gui) + target_link_libraries(${_testname} Qt${QT_MAJOR_VERSION}::Gui) ecm_mark_as_test(${_testname}) endforeach(_testname) endmacro()