cmake_minimum_required(VERSION 3.6.0 FATAL_ERROR)

project(cutelyst_benchmarks LANGUAGES CXX)

find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core Network Sql)
find_package(ASqlQt5 0.15.0 REQUIRED)
find_package(Cutelyst2Qt5 2.12 REQUIRED)

# Auto generate moc files
set(CMAKE_AUTOMOC ON)

# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

file(GLOB_RECURSE TEMPLATES_SRC root/*)

set(cutelyst_benchmarks_SRCS
    cutelyst-benchmarks.cpp
    cutelyst-benchmarks.h
    databaseupdatestest.cpp
    databaseupdatestest.h
    fortunetest.cpp
    fortunetest.h
    jsontest.cpp
    jsontest.h
    multipledatabasequeriestest.cpp
    multipledatabasequeriestest.h
    plaintexttest.cpp
    plaintexttest.h
    root.cpp
    root.h
    singledatabasequerytest.cpp
    singledatabasequerytest.h
    ${TEMPLATES_SRC}
)

# Create the application
add_library(cutelyst_benchmarks SHARED ${cutelyst_benchmarks_SRCS})

# Link to Cutelyst
target_link_libraries(cutelyst_benchmarks
    PUBLIC
    Cutelyst::Core
    Cutelyst::Utils::Sql
    Cutelyst::View::Cutelee
    Qt5::Core
    Qt5::Network
    Qt5::Sql
    ASqlQt5::Core
)

add_executable(cutelyst-benchmarks main.cpp)
target_link_libraries(cutelyst-benchmarks
    Cutelyst::Core
    Cutelyst::WSGI
    Qt5::Network
    cutelyst_benchmarks
)
