# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

qt_add_plugin(googlefonts
    CLASS_NAME GoogleFonts
    cgooglefonts.cpp cgooglefonts.h ../../app/cfontinfo.cpp ../../app/cfontinfo.h
)

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Network)

set_target_properties(googlefonts PROPERTIES
    LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)

target_include_directories(googlefonts PRIVATE
    ../../app
)

target_link_libraries(googlefonts PRIVATE
    Qt6::Core
    Qt6::Gui
    Qt6::Widgets
    Qt6::Network
)

if(TARGET Qt6::PrintSupport)
    target_link_libraries(googlefonts PRIVATE Qt6::PrintSupport)
endif()

if(WIN32)
    set(install_destination "${CMAKE_INSTALL_BINDIR}")
elseif(APPLE)
    set(install_destination ".")
else()
    set(install_destination "${CMAKE_INSTALL_BINDIR}")
endif()
install(TARGETS googlefonts
    RUNTIME DESTINATION "${install_destination}"
    LIBRARY DESTINATION "${install_destination}"
)
