cmake_minimum_required(VERSION 3.10)

# --- Project riêng cho utils ---
project(utils LANGUAGES CXX)

# --- Tạo INTERFACE library (header-only) ---
add_library(utils INTERFACE)

# --- Include directories ---
target_include_directories(utils
    INTERFACE
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>   # build nội bộ
        $<INSTALL_INTERFACE:include/utils>             # dùng khi install/export
)

# --- Cài đặt header files ---
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
        DESTINATION include/utils
        FILES_MATCHING PATTERN "*.h"
)

# --- Cài đặt target INTERFACE để export ---
install(TARGETS utils
        EXPORT utils-targets
)

# --- Export target file ---
install(EXPORT utils-targets
        FILE utils-targets.cmake
        NAMESPACE utils::
        DESTINATION lib/cmake/utils
)
