find_package(PkgConfig REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Widgets Xml Network LinguistTools)

pkg_check_modules(LIBEPT libept)

add_executable(packagesearch 
    action.cpp
    action.h
    actionplugin.cpp
    actionplugin.h
    applicationfactory.cpp
    applicationfactory.h
    baseplugincontainer.cpp
    baseplugincontainer.h
    columncontroldlg.cpp
    columncontroldlg.h
    exception.cpp
    exception.h
    extalgorithm.cpp
    extalgorithm.h
    gainroot.cpp
    gainroot.h
    globals.h
    helpers.h
    history.cpp
    history.h
    informationplugin.h
    ipluginfactory.h
    iplugininformer.h
    ipluginuser.h
    iprogressobserver.h
    iprovider.h
    iscorecalculationstrategy.h
    ixmlstorable.h
    main.cpp
    networksettings.cpp
    networksettings.h
    packagedisplaywidget.cpp
    packagedisplaywidget.h
    packagenameplugin.cpp
    packagenameplugin.h
    packagenotfoundexception.cpp
    packagenotfoundexception.h
    packagesearchaboutdlg.cpp
    packagesearchaboutdlg.h
    packagesearchimpl.cpp
    packagesearchimpl.h
    plugincompare.h
    plugincontainer.cpp
    plugincontainer.h
    plugincontroldlgmeditator.cpp
    plugincontroldlgmeditator.h
    plugin.cpp
    plugin.h
    plugininformer.cpp
    plugininformer.h
    pluginmanager.cpp
    pluginmanager.h
    processcontainer.cpp
    processcontainer.h
    progressdisplaydlg.cpp
    progressdisplaydlg.h
    runcommand.cpp
    runcommandforoutput.cpp
    runcommandforoutput.h
    runcommand.h
    runcommandinwindow.cpp
    runcommandinwindow.h
    runcommandinxterm.cpp
    runcommandinxterm.h
    scorecalculationstrategybase.cpp
    scorecalculationstrategybase.h
    scoredisplayplugin.cpp
    scoredisplayplugin.h
    scoreplugin.h
    searchplugin.h
    settingsdlg.cpp
    settingsdlg.h
    shortinformationplugin.h
    singleton.cpp
    singleton.h
    translationmanager.cpp
    translationmanager.h
    xmldata.cpp
    xmldata.h
    
    # ui files
    packagesearch.ui 
    packagesearchaboutdlg.ui 
    plugincontrol.ui 
    columncontroldlg.ui 
    settingsdlg.ui
)


qt_add_translations(packagesearch TS_FILES 
    ${PROJECT_SOURCE_DIR}/translations/packagesearch_de.ts 
    ${PROJECT_SOURCE_DIR}/translations/packagesearch_es.ts
)

target_link_libraries(packagesearch PRIVATE Qt6::Widgets Qt6::Xml Qt6::Network)
target_link_libraries(packagesearch PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(packagesearch PRIVATE ${LIBEPT_LIBRARIES})

target_link_options(packagesearch PRIVATE "LINKER:-export-dynamic" "LINKER:--no-add-needed")

install(TARGETS packagesearch DESTINATION bin)

install(FILES 
    ${CMAKE_CURRENT_BINARY_DIR}/packagesearch_de.qm
    ${CMAKE_CURRENT_BINARY_DIR}/packagesearch_es.qm
    DESTINATION ${TRANSLATION_TARGET_DIR}
)



