cmake_minimum_required(VERSION 3.1.0)
project(colnod-connector VERSION 0.1.0)

message(">> APP ${PROJECT_NAME} ${PROJECT_VERSION}")

cmake_policy(SET CMP0063 NEW)
cmake_policy(SET CMP0075 NEW)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(Qt5 COMPONENTS Sql REQUIRED)
find_package(Qt5 COMPONENTS Network REQUIRED)

# find all cpp files from app and colnod folders
# app contains main()
file(GLOB_RECURSE APP_SOURCE_FILES FILES_MATCHING PATTERN "app/*.cpp")
# colnod contains additional files, but is part of the application executable
# so we do not make colnod folder into separate library but include it in the final executable directly
file(GLOB_RECURSE COLNOD_SOURCE_FILES FILES_MATCHING PATTERN "colnod/*.cpp")

# creates actual cmake target seen in cmake
add_executable(${PROJECT_NAME} ${APP_SOURCE_FILES} ${COLNOD_SOURCE_FILES})

# link QT and server-sdk submodule
target_link_libraries(${PROJECT_NAME}
    Qt5::Core
    Qt5::Sql
    Qt5::Network
    serversdk # link server-sdk git submodule
)

set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
target_compile_options(${PROJECT_NAME} PUBLIC -O0 -Wall)
