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

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
    packagename.cpp
    packagename.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.h
    runcommand.cpp
    runcommandforoutput.cpp
    runcommandforoutput.h
    runcommandforparsing.h
    runcommandforparsing.cpp
    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
)

# does not work -> maybe only in QT 6.7?
#set_source_files_properties(packagesearch_de.ts
#    PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translationsxx")

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

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

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
    DESTINATION ${TRANSLATION_TARGET_DIR}
)



