project(qapttest)
cmake_minimum_required(VERSION 3.16)

set(QT_MIN_VERSION "5.15.2")
set(KF5_MIN_VERSION "5.96.0")
set(KDE_COMPILERSETTINGS_LEVEL "5.84")

if (QT_MAJOR_VERSION STREQUAL "6")
    set(QT_REQUIRED_VERSION "6.4.0")
    set(QT_MIN_VERSION "${QT_REQUIRED_VERSION}")
    set(KF_MIN_VERSION "5.240.0")
    set(KF_MAJOR_VERSION "6")
else()
    set(KF_MAJOR_VERSION "5")
endif()

find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Widgets)
find_package(KF${KF_MAJOR_VERSION} ${KF5_MIN_VERSION} COMPONENTS CoreAddons I18n KIO IconThemes TextWidgets WidgetsAddons WindowSystem)

if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
    find_package(QApt REQUIRED)
endif()
include(KDECMakeSettings NO_POLICY_SCOPE)
include(KDECompilerSettings NO_POLICY_SCOPE)

set(qapttest_SRCS
    main.cpp
    qapttest.cpp
    cacheupdatewidget.cpp
    commitwidget.cpp
 )

add_executable(qaptest ${qapttest_SRCS})

target_link_libraries(qaptest KF${KF_MAJOR_VERSION}::CoreAddons
                              KF${KF_MAJOR_VERSION}::I18n
                              KF${KF_MAJOR_VERSION}::KIOCore
                              KF${KF_MAJOR_VERSION}::TextWidgets
                              KF${KF_MAJOR_VERSION}::WidgetsAddons
                              QApt::Main
                              DebconfKDE::Main)

install(TARGETS qaptest ${INSTALL_TARGETS_DEFAULT_ARGS} )

