bettola/CMakeLists.txt

56 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(bettola CXX C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# === Sol2 ===
include(FetchContent)
FetchContent_Declare(
sol2
GIT_REPOSITORY https://github.com/ThePhD/sol2.git
GIT_TAG v3.3.1
)
FetchContent_MakeAvailable(sol2)
# === Asio ===
FetchContent_Declare(
asio
GIT_REPOSITORY https://github.com/chriskohlhoff/asio
git_TAG asio-1-36-0
)
FetchContent_MakeAvailable(asio)
# === SQLite ===
# Supress the developer warning for using Populate with declared content.
# We need it because sqlite zip isn't a CMAKE project.
cmake_policy(SET CMP0169 OLD)
FetchContent_Declare(
sqlite_source
URL https://sqlite.org/2025/sqlite-amalgamation-3500400.zip
URL_HASH SHA256=1d3049dd0f830a025a53105fc79fd2ab9431aea99e137809d064d8ee8356b032
DOWNLOAD_EXTRACT_TIMESTAMP true
)
FetchContent_GetProperties(sqlite_source)
if(NOT sqlite_source_POPULATED)
FetchContent_Populate(sqlite_source)
add_library(sqlite STATIC "${sqlite_source_SOURCE_DIR}/sqlite3.c")
target_include_directories(sqlite PUBLIC "${sqlite_source_SOURCE_DIR}")
endif()
# Revert policy to default.
cmake_policy(SET CMP0169 NEW)
# === sqlite_modern_cpp (SQLite wrapper) ===
FetchContent_Declare(
sqlite_modern_cpp
GIT_REPOSITORY https://github.com/SqliteModernCpp/sqlite_modern_cpp.git
GIT_TAG v3.2
)
FetchContent_MakeAvailable(sqlite_modern_cpp)
add_subdirectory(common)
add_subdirectory(client)
add_subdirectory(server)