cmake_minimum_required(VERSION 3.16)
project(lidar_manager_web LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

include(FetchContent)
find_package(Threads REQUIRED)

FetchContent_Declare(
  cpp_httplib
  GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
  GIT_TAG v0.44.0
)
FetchContent_GetProperties(cpp_httplib)
if(NOT cpp_httplib_POPULATED)
  FetchContent_Populate(cpp_httplib)
endif()

FetchContent_Declare(
  nlohmann_json
  URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
)
FetchContent_GetProperties(nlohmann_json)
if(NOT nlohmann_json_POPULATED)
  FetchContent_Populate(nlohmann_json)
endif()

add_executable(lidar_manager_web
  src/main.cpp
)

target_link_libraries(lidar_manager_web PRIVATE Threads::Threads)

target_include_directories(lidar_manager_web SYSTEM PRIVATE
  "${cpp_httplib_SOURCE_DIR}"
  "${nlohmann_json_SOURCE_DIR}/single_include"
)

target_compile_definitions(lidar_manager_web PRIVATE
  _DEFAULT_SOURCE
)
