cmake_minimum_required(VERSION 3.10)
project(geometry_msgs)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Thư viện header-only
add_library(geometry_msgs INTERFACE)

# Include path tới thư mục chứa file header
target_include_directories(geometry_msgs
    INTERFACE
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
        $<INSTALL_INTERFACE:include>
)

# Liên kết với std_msgs nếu bạn có file Header.h trong include/std_msgs/
target_link_libraries(geometry_msgs INTERFACE std_msgs utils)

# --- Cài đặt thư viện vào hệ thống khi chạy make install ---
install(TARGETS geometry_msgs
  EXPORT geometry_msgs-targets
  INCLUDES DESTINATION include # Cài đặt include
)

# --- Xuất export set costmap_2dTargets thành file CMake module ---
# --- Tạo file lib/cmake/geometry_msgs/costmap_2dTargets.cmake ---
# --- File này chứa cấu hình giúp project khác có thể dùng ---
# --- Find_package(geometry_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE geometry_msgs::geometry_msgs) ---
install(EXPORT geometry_msgs-targets 
  FILE geometry_msgs-targets.cmake
  NAMESPACE geometry_msgs::
  DESTINATION lib/cmake/geometry_msgs
)

add_executable(test_geometry test/main.cpp)
target_link_libraries(test_geometry PRIVATE geometry_msgs)

