gadm-ts/cpp/CMakeLists.txt
2026-03-23 15:32:00 +01:00

70 lines
2.9 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(polymech-cli
VERSION 0.1.0
DESCRIPTION "Polymech C++ CLI"
LANGUAGES CXX C
)
# ── C++ standard ─────────────────────────────────────────────────────────────
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ── Dependencies ─────────────────────────────────────────────────────────────
include(FetchContent)
FetchContent_Declare(
cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.2
GIT_SHALLOW TRUE
)
FetchContent_Declare(
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.4.0
GIT_SHALLOW TRUE
)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.7.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(cli11 tomlplusplus Catch2)
# ── Packages ─────────────────────────────────────────────────────────────────
add_subdirectory(packages/logger)
add_subdirectory(packages/html)
add_subdirectory(packages/postgres)
add_subdirectory(packages/http)
add_subdirectory(packages/json)
add_subdirectory(packages/polymech)
# ── Sources ──────────────────────────────────────────────────────────────────
add_executable(${PROJECT_NAME}
src/main.cpp
)
target_link_libraries(${PROJECT_NAME} PRIVATE CLI11::CLI11 tomlplusplus::tomlplusplus logger html postgres http json polymech)
# ── Compiler warnings ───────────────────────────────────────────────────────
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /permissive-)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic)
endif()
# ── Install ──────────────────────────────────────────────────────────────────
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
# ── Tests ────────────────────────────────────────────────────────────────────
enable_testing()
add_subdirectory(tests)