cmake_minimum_required(VERSION 3.18)

project(blogi)

include(GNUInstallDirs)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(WINDOWS_EXPORT_ALL_SYMBOLS ON)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

find_package(libnetplus REQUIRED)
find_package(libhtmlpp REQUIRED)
find_package(libhttppp REQUIRED)
find_package(Brotli REQUIRED)
find_package(libcmdplus REQUIRED)
find_package(libconfplus REQUIRED)
find_package(libdbpp REQUIRED)
find_package(authdb REQUIRED)
find_package(json-c REQUIRED)
find_package(smtpclient REQUIRED)
find_package(libuuidp REQUIRED)
find_package(tinyxml2 REQUIRED)
find_package(paritypp REQUIRED)

if(APPLE OR ${CMAKE_HOST_SYSTEM_NAME} MATCHES "FreeBSD")
    find_package(date REQUIRED)
endif()

add_definitions(-D${CMAKE_HOST_SYSTEM_NAME} -DWIN32_LEAN_AND_MEAN)

include_directories(
    ${NETPLUS_INCLUDE_DIRS}
    ${HTTPPP_INCLUDE_DIRS}
    ${CMAKE_SOURCE_DIR}/src
    ${SECUREID_INCLUDE_DIRS}
    ${DBPP_INCLUDE_DIR}
    ${LIBUUIDP_INCLUDE_DIR}
)

add_subdirectory(src)
add_subdirectory(plugins)
add_subdirectory(tests)
add_subdirectory(data)

option(BUILD_EDITOR "Build the Qt desktop editor" OFF)
if(BUILD_EDITOR)
    add_subdirectory(editor)
endif()
