# SPDX-FileCopyrightText: 2024 g10 code GmbH
# SPDX-Contributor: Carl Schwan <carl.schwan@gnupg.com>
# SPDX-License-Identifier: BSD-2-Clause

add_library(rootcagenerator STATIC)

target_sources(rootcagenerator PRIVATE
    controller.cpp
    controller.h
    truststore.cpp
    truststore.h
)

if (WIN32)
    install(FILES install.ps1 DESTINATION ${KDE_INSTALL_BINDIR})
else()
    target_link_libraries(rootcagenerator PRIVATE KF6::AuthCore)

    add_executable(truststore_linux_helper
        truststore_linux_helper.cpp
        truststore_linux_helper.h
    )
    target_link_libraries(truststore_linux_helper KF6::I18n KF6::AuthCore Qt::Core)
    install(TARGETS truststore_linux_helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})

    kauth_install_actions(com.gnupg.gpgolweb.truststore com.gnupg.gpgolweb.truststore.actions)
    kauth_install_helper_files(truststore_linux_helper com.gnupg.gpgolweb.truststore root)
endif()

target_link_libraries(rootcagenerator PUBLIC KPim6::Libkleo KF6::I18n KF6::CoreAddons)

add_executable(gpgol-cert-generator main.cpp)
target_link_libraries(gpgol-cert-generator PUBLIC rootcagenerator)
install(TARGETS gpgol-cert-generator ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})

