cmake_minimum_required(VERSION 3.10)

project(UsbMakroBoard VERSION 1.0)

# Add the executable target
add_executable(usbmakroboard
    src/main.cpp  # Add your source files here
)

# Include yaml-cpp as a dependency
include(FetchContent)

FetchContent_Declare(
  yaml-cpp
  GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
  GIT_TAG master
)
FetchContent_GetProperties(yaml-cpp)

if(NOT yaml-cpp_POPULATED)
  message(STATUS "Fetching yaml-cpp...")
  FetchContent_Populate(yaml-cpp)
  add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR})
endif()

# Link yaml-cpp with your executable
target_link_libraries(usbmakroboard PUBLIC yaml-cpp::yaml-cpp)

# Include spdlog as a dependency
include(FetchContent)

FetchContent_Declare(
  spdlog
  GIT_REPOSITORY https://github.com/gabime/spdlog.git
  GIT_TAG v1.14.1
)
FetchContent_GetProperties(spdlog)

if(NOT spdlog_POPULATED)
  message(STATUS "Fetching spdlog...")
  FetchContent_Populate(spdlog)
  add_subdirectory(${spdlog_SOURCE_DIR} ${spdlog_BINARY_DIR})
endif()

# Link spdlog with your executable
target_link_libraries(usbmakroboard PRIVATE spdlog::spdlog)

install(TARGETS usbmakroboard DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")