Files
Arena/CMakeLists.txt

39 lines
957 B
CMake
Raw Normal View History

2026-03-29 10:40:09 -06:00
cmake_minimum_required(VERSION 3.20)
2026-05-20 17:00:02 -06:00
project(
arena
VERSION 1.0
LANGUAGES C)
2026-03-29 10:40:09 -06:00
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
2026-05-20 17:00:02 -06:00
# ------------------------------------------------
# Detectar si este proyecto es el principal
# ------------------------------------------------
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(ARENA_IS_TOP_LEVEL ON)
else()
set(ARENA_IS_TOP_LEVEL OFF)
endif()
2026-04-23 12:09:07 -06:00
# Opciones
2026-05-20 17:00:02 -06:00
option(ARRAYLIST_BUILD_TESTS "Build arena tests" ${ARENA_IS_TOP_LEVEL})
option(ARRAYLIST_ENABLE_SANITIZERS "Enable sanitizers for tests" ON)
2026-04-23 12:09:07 -06:00
# Librería
2026-05-20 17:00:02 -06:00
add_library(arena src/arena.c)
2026-04-23 12:00:35 -06:00
2026-05-20 17:00:02 -06:00
target_include_directories(
arena PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
2026-03-29 10:40:09 -06:00
2026-05-20 17:00:02 -06:00
target_compile_options(arena PRIVATE -Wall -Wextra -Wpedantic)
2026-03-29 10:40:09 -06:00
# ------------------------
2026-04-23 12:09:07 -06:00
# Testing
2026-03-29 10:40:09 -06:00
# ------------------------
2026-04-23 12:09:07 -06:00
if(ARENA_BUILD_TESTS)
2026-05-20 17:00:02 -06:00
enable_testing()
add_subdirectory(test)
endif()