# This file is part of the Flowee project
# Copyright (C) 2025 Tom Zander <tom@flowee.org>
#
# 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/>.

cmake_minimum_required (VERSION 3.21)
project (registry)

set(COPYRIGHT_YEAR 2025)
set(CLIENT_VERSION_MAJOR ${COPYRIGHT_YEAR})
set(CLIENT_VERSION_MINOR 1)
set(CLIENT_VERSION_REVISION 1)

# ------------------------------------------------------------------------------------

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 COMPONENTS Core Network REQUIRED)

if (CMAKE_VERSION VERSION_GREATER "3.29.9")
    # use the upstream boost info instead of the cmake-shipped one for finding
    # this policy was introduced in cmake 3.30
   cmake_policy(SET CMP0167 NEW)
endif()
find_package(Boost 1.74.0 REQUIRED filesystem thread iostreams)

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
    message(STATUS "Setting build type to 'ReleaseWithDebugInfo' as none was specified.")
    set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
    # Set the possible values of build type for cmake-gui
    set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo")
elseif (NOT CMAKE_CONFIGURATION_TYPES)
    message(STATUS "Built type is ${CMAKE_BUILD_TYPE}")
endif ()

find_package(Flowee REQUIRED)

if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
    add_definitions(-DBCH_NO_DEBUG_OUTPUT)
else ()
    add_definitions(-DBCH_LOGCONTEXT)
endif ()

add_subdirectory(src)
