cmake_minimum_required(VERSION 3.20)
project(graph VERSION 1.0 LANGUAGES C)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

# clangd
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Opciones
option(GRAPH_BUILD_TESTS "Build arraylist tests" OFF)
option(GRAPH_ENABLE_SANITIZERS "Enable sanitizers for tests" ON)

# ------------------------
# Library
# ------------------------
add_library(graph
    src/graph.c
)

target_include_directories(graph
    PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
        $<INSTALL_INTERFACE:include>
)

target_compile_options(graph PRIVATE
    -Wall
    -Wextra
    -Wpedantic
)

# ------------------------
# Example (opcional)
# ------------------------
add_executable(graph_example src/main.c)

target_link_libraries(graph_example
    graph
)

# ------------------------
# Testing
# ------------------------
if(ARRAYLIST_BUILD_TESTS)
    enable_testing()
    add_subdirectory(test)
endif()
