61 lines
1.1 KiB
CMake
61 lines
1.1 KiB
CMake
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)
|
|
|
|
include(cmake/CPM.cmake)
|
|
|
|
CPMAddPackage(
|
|
NAME arraylist
|
|
GIT_REPOSITORY https://laentropia-homelab.tail7368da.ts.net/laentropia/ArrayList.git
|
|
GIT_TAG main
|
|
)
|
|
|
|
# ------------------------
|
|
# 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
|
|
)
|
|
|
|
target_link_libraries(graph
|
|
PUBLIC arraylist
|
|
)
|
|
|
|
# ------------------------
|
|
# Testing
|
|
# ------------------------
|
|
if(ARRAYLIST_BUILD_TESTS)
|
|
enable_testing()
|
|
add_subdirectory(test)
|
|
endif()
|