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

cmake_minimum_required(VERSION 3.20)

set(MODULE_NAME "SecondPlugin")
project(${MODULE_NAME} LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)

file(GLOB QML_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.qml)
source_group("Qml Files" FILES ${QML_SOURCES})

# file(GLOB CPP_SOURCES *.cpp)
# file(GLOB HPP_SOURCES *.h)
//! [add library]
qt_add_library(${MyModule} STATIC)

qt6_add_qml_module(${MyModule}
    URI ${MyModule}
    VERSION 1.0
    QML_FILES ${QML_SOURCES}
    # SOURCES ${CPP_SOURCES} ${HPP_SOURCES}
)
//! [add library]
set_target_properties(${MODULE_NAME} PROPERTIES
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE FALSE
)


target_link_libraries(${MODULE_NAME} PRIVATE
    Qt::Core
    Qt::Gui
    Qt::Qml
    Qt::Quick
)

target_include_directories(${MODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
