# -*- mode:cmake -*-

# Copyright 2021 The Foedag team

# GPL License

# Copyright (c) 2021 The Open-Source FPGA Foundation

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program 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 General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
if(USE_MONACO_EDITOR)
    find_package(Qt6 COMPONENTS Core Gui Widgets Xml WebEngineWidgets WebChannel REQUIRED)
else()
    find_package(Qt6 COMPONENTS Core Gui Widgets Xml REQUIRED)
endif()

if (NOT Qt6Widgets_FOUND)
    message(STATUS "Failed to find Qt6Widgets required (on debian/ubuntu try 'sudo apt install qt6-base-dev')")
elseif (NOT Qt6Gui_FOUND)
    message(STATUS "Failed to find Qt6Gui required (on debian/ubuntu try 'sudo apt install qt6-base-dev')")
elseif (NOT Qt6Core_FOUND)
    message(STATUS "Failed to find Qt6Core required (on debian/ubuntu try 'sudo apt install qt6-base-dev')")
elseif (NOT Qt6Xml_FOUND)
    message(STATUS "Failed to find Qt6Xml required (on debian/ubuntu try 'sudo apt install qt6-base-dev')")
elseif (USE_MONACO_EDITOR AND NOT Qt6WebEngineWidgets_FOUND)
    message(STATUS "Failed to find Qt6WebEngineWidgets required (on debian/ubuntu try 'sudo apt install qt6-webengine-dev qt6-webengine* libqt6webenginecore6*')")
elseif (USE_MONACO_EDITOR AND NOT Qt6WebChannel_FOUND)
    message(STATUS "Failed to find Qt6WebChannel required (on debian/ubuntu try 'sudo apt install qt6-webengine-dev qt6-webengine* libqt6webenginecore6*')")
else()
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTORCC ON)
endif()

