################################################################################
## Author: Shaun Reed                                                         ##
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved                ##
## About: Practice project for using Qt Designer with custom C++ widgets      ##
##                                                                            ##
## Contact: shaunrd0@gmail.com  | URL: www.shaunreed.com | GitHub: shaunrd0   ##
################################################################################

cmake_minimum_required(VERSION 3.15)

project(
    #[[NAME]]       Designer
    VERSION         0.1
    DESCRIPTION     "Practice using Qt designer for desktop applications"
    LANGUAGES       CXX
)

add_compile_options(-Wall)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(QT_DIR "$ENV{HOME}/Code/Clones/Qt/6.3.1/gcc_64/" CACHE PATH "Path to Qt6")

list(APPEND CMAKE_PREFIX_PATH "${QT_DIR}")

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)

qt_add_executable(designer
    designer.cpp designer.h designer.ui
    debugconsole.h debugconsole.cpp debugconsole.ui
    texteditor.h texteditor.cpp texteditor.ui
    treeview.h treeview.cpp treeview.ui
    main.cpp
)

set_target_properties(designer PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

target_link_libraries(designer PUBLIC Qt::Core Qt::Gui Qt::Widgets)

install(TARGETS designer
    RUNTIME DESTINATION "install/designer"
    BUNDLE DESTINATION "install/designer"
    LIBRARY DESTINATION "install/designer"
)
