2026-04-13 11:16:58 -06:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
2026-04-23 12:23:52 -06:00
|
|
|
project(arraylist VERSION 1.0 LANGUAGES C)
|
2026-04-13 11:16:58 -06:00
|
|
|
|
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
# clangd
|
2026-04-13 11:16:58 -06:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
# Opciones
|
2026-05-14 08:20:56 -06:00
|
|
|
option(ARRAYLIST_BUILD_TESTS "Build arraylist tests" ON)
|
2026-04-23 12:23:52 -06:00
|
|
|
option(ARRAYLIST_ENABLE_SANITIZERS "Enable sanitizers for tests" ON)
|
2026-04-13 11:16:58 -06:00
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
# ------------------------
|
|
|
|
|
# Library
|
|
|
|
|
# ------------------------
|
|
|
|
|
add_library(arraylist
|
2026-04-13 11:16:58 -06:00
|
|
|
src/arraylist.c
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
target_include_directories(arraylist
|
|
|
|
|
PUBLIC
|
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
|
)
|
2026-04-13 11:16:58 -06:00
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
target_compile_options(arraylist PRIVATE
|
|
|
|
|
-Wall
|
|
|
|
|
-Wextra
|
|
|
|
|
-Wpedantic
|
|
|
|
|
)
|
2026-04-13 11:16:58 -06:00
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
# ------------------------
|
|
|
|
|
# Example (opcional)
|
|
|
|
|
# ------------------------
|
|
|
|
|
add_executable(arraylist_example src/main.c)
|
2026-04-13 11:16:58 -06:00
|
|
|
|
2026-04-23 12:23:52 -06:00
|
|
|
target_link_libraries(arraylist_example
|
|
|
|
|
arraylist
|
|
|
|
|
)
|
2026-04-13 11:16:58 -06:00
|
|
|
|
|
|
|
|
# ------------------------
|
|
|
|
|
# Testing
|
|
|
|
|
# ------------------------
|
2026-04-23 12:23:52 -06:00
|
|
|
if(ARRAYLIST_BUILD_TESTS)
|
|
|
|
|
enable_testing()
|
|
|
|
|
add_subdirectory(test)
|
|
|
|
|
endif()
|