cmake_minimum_required(VERSION 4.2)
project(logging_debug)

add_compile_options(-Wall -Wextra -Wpedantic)

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(spdlog REQUIRED)

add_executable(roslog src/roslog.cpp)
target_link_libraries(roslog rclcpp::rclcpp)
target_compile_features(roslog PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17

add_executable(spdlog src/spdlog.cpp)
target_link_libraries(spdlog rclcpp::rclcpp spdlog::spdlog)
target_compile_features(spdlog PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17

add_executable(nolog src/nolog.cpp)
target_link_libraries(nolog rclcpp::rclcpp)
target_compile_features(nolog PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17

add_executable(spdlog_macro src/spdlog_macro.cpp)
target_link_libraries(spdlog_macro rclcpp::rclcpp spdlog::spdlog)
target_compile_features(spdlog_macro PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17
target_compile_definitions(spdlog_macro PRIVATE SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_INFO)


install(TARGETS
  roslog
  spdlog
  spdlog_macro
  nolog
  DESTINATION lib/${PROJECT_NAME})

ament_package()
