#-----------------------------------------------------------------------------
#
# Copyright (C) 2022 Bjarne von Horn <vh@igh.de>
#
# This file is part of the QtPdWidgets library.
#
# The QtPdWidgets library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# The QtPdWidgets library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the QtPdWidgets Library. If not, see
# <http://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------------

cmake_minimum_required(VERSION 3.10)

project(QmlTest)

# load Qt
find_package(Qt5 REQUIRED
    COMPONENTS Charts Gui Quick QuickControls2 Svg Xml
    OPTIONAL_COMPONENTS QuickCompiler
)
# load Widgets with QML files
find_package(QtPdWidgets2 REQUIRED COMPONENTS Qml)

# compile qml files (of this project) if compiler available
if(COMMAND qtquick_compiler_add_resources)
    qtquick_compiler_add_resources(RCC_SOURCES resources.qrc)
else()
    qt5_add_resources(RCC_SOURCES resources.qrc)
endif()

add_executable(${PROJECT_NAME}
    src/ScalarSeries.h
    src/QmlBuddy.h
    src/ScalarSeries.cpp
    src/QmlBuddy.cpp
    src/main.cpp

    ${RCC_SOURCES}
)

set_target_properties(${PROJECT_NAME} PROPERTIES
    AUTOUIC 0
    AUTOMOC 1
    AUTORCC 0
)

# link in Qt, the PdWidgets and the PdWidgets QML files

target_link_libraries(${PROJECT_NAME} PUBLIC
    EtherLab::QtPdWidgets2
    EtherLab::QmlPdWidgets2
    Qt5::Charts
    Qt5::Quick
    Qt5::QuickControls2
)
