Commit c22200f4 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Adapt build system for building against qt6

(cherry picked from commit c886b918151a4e07008c39fec0f115691890b9e0)
parent a9db5add
Pipeline #120976 passed with stage
in 2 minutes and 8 seconds
......@@ -24,7 +24,10 @@ include(ECMAddQch)
set(KMIME_LIB_VERSION ${PIM_VERSION})
set(QT_REQUIRED_VERSION "5.15.2")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core)
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core)
if (QT_MAJOR_VERSION STREQUAL "6")
find_package(Qt6Core5Compat)
endif()
ecm_setup_version(PROJECT VARIABLE_PREFIX KMIME
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kmime_version.h"
......@@ -80,7 +83,7 @@ install(EXPORT KF5MimeTargets
install(FILES
${KMime_BINARY_DIR}/kmime_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}
COMPONENT Devel
)
......
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Core @QT_REQUIRED_VERSION@)
find_dependency(Qt@QT_MAJOR_VERSION@Core @QT_REQUIRED_VERSION@)
find_dependency(KF5Codecs @KF5_MIN_VERSION@)
include("${CMAKE_CURRENT_LIST_DIR}/KF5MimeTargets.cmake")
include(ECMMarkAsTest)
find_package(Qt5Test ${QT_REQUIRED_VERSION} CONFIG REQUIRED)
find_package(Qt${QT_MAJOR_VERSION}Test ${QT_REQUIRED_VERSION} CONFIG REQUIRED)
# Turn exceptions on
kde_enable_exceptions()
......@@ -18,9 +18,12 @@ macro(ADD_KMIME_TEST)
add_test(NAME kmime-${_testName} COMMAND ${_testName})
target_link_libraries(${_testName}
KF5Mime
Qt::Test
Qt${QT_MAJOR_VERSION}::Test
KF5::Codecs
)
if (TARGET Qt6::Core5Compat)
target_link_libraries(${_testName} Qt6::Core5Compat) # QTextCodec
endif()
set_target_properties(${_testName} PROPERTIES COMPILE_FLAGS -DTEST_DATA_DIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\"" )
ecm_mark_as_test(${_testName})
set_tests_properties(kmime-${_testName} PROPERTIES ENVIRONMENT "LANG=C")
......
......@@ -16,5 +16,5 @@ set(KMime_HEADERS
install(FILES
${KMime_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KMime/KMime COMPONENT Devel
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KMime/KMime COMPONENT Devel
)
......@@ -52,7 +52,7 @@ if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
endif()
generate_export_header(KF5Mime BASE_NAME KMime)
target_include_directories(KF5Mime INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KMime>")
target_include_directories(KF5Mime INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF}/KMime>")
target_include_directories(KF5Mime PUBLIC "$<BUILD_INTERFACE:${KMime_SOURCE_DIR}/src;${KMime_BINARY_DIR}/src;${KMime_BINARY_DIR}>")
if (WIN32)
......@@ -61,12 +61,15 @@ endif()
target_link_libraries(KF5Mime
PUBLIC
Qt::Core
Qt${QT_MAJOR_VERSION}::Core
PRIVATE
KF5::I18n
KF5::Codecs
${_kmime_extra_libs}
)
if (TARGET Qt6::Core5Compat)
target_link_libraries(KF5Mime PRIVATE Qt6::Core5Compat) # QTextCodec
endif()
set_target_properties(KF5Mime PROPERTIES
VERSION ${KMIME_VERSION}
......@@ -102,7 +105,7 @@ install(FILES
kmime_dateformatter.h
kmime_util.h
kmime_types.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KMime/kmime COMPONENT Devel
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KMime/kmime COMPONENT Devel
)
if (BUILD_QCH)
......@@ -130,5 +133,5 @@ endif()
ecm_qt_install_logging_categories(EXPORT KMIME FILE kmime.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
ecm_generate_pri_file(BASE_NAME KMime LIB_NAME KF5Mime DEPS "" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KMime)
ecm_generate_pri_file(BASE_NAME KMime LIB_NAME KF5Mime DEPS "" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF}/KMime)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment