C reference parsing library for Eno
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

90 lines
2.6 KiB

cmake_minimum_required(VERSION 3.1...3.13)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(eno VERSION 0.1.0
DESCRIPTION "Eno parsing library for C"
LANGUAGES C)
set(CMAKE_C_STANDARD 90)
if(MSVC)
add_compile_options(/W4 /WX)
else()
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif()
# Uncomment for gdb symbol table generation
# set(CMAKE_BUILD_TYPE Debug)
# Uncomment for leak detection/segfault troubleshooting
# set(CMAKE_C_FLAGS "-fsanitize=address")
# ICU dependency
# --------------
find_package(PkgConfig REQUIRED)
pkg_check_modules(ICU_IO REQUIRED IMPORTED_TARGET icu-io)
pkg_check_modules(ICU_UC REQUIRED IMPORTED_TARGET icu-uc) # TODO: Possibly unused (?) (compare with meson.build)
# Main library target: libeno
# ---------------------------
add_library(eno STATIC lib/assemble.c
lib/compare.c
lib/debug.c
lib/error.c
lib/free.c
lib/get.c
lib/iterate.c
lib/parse.c
lib/query.c
lib/read.c
lib/resolve.c)
target_include_directories(eno PUBLIC include)
# Test binary target: test_error_examples
# ------------------------------
add_executable(test_error_examples test/error_examples.c
test/helpers.c)
target_link_libraries(test_error_examples PUBLIC eno)
target_link_libraries(test_error_examples PUBLIC PkgConfig::ICU_IO)
target_link_libraries(test_error_examples PUBLIC PkgConfig::ICU_UC)
# Test binary target: test_examples
# ------------------------------
add_executable(test_examples test/examples.c
test/helpers.c
test/serialize_external_ast.c
test/serialize_internal_ast.c)
target_link_libraries(test_examples PUBLIC eno)
target_link_libraries(test_examples PUBLIC PkgConfig::ICU_IO)
target_link_libraries(test_examples PUBLIC PkgConfig::ICU_UC)
# Test binary target: test_get
# ------------------------------
add_executable(test_get test/get.c)
target_link_libraries(test_get PUBLIC eno)
target_link_libraries(test_get PUBLIC PkgConfig::ICU_IO)
target_link_libraries(test_get PUBLIC PkgConfig::ICU_UC)
# Test binary target: test_parse
# ------------------------------
add_executable(test_parse test/parse.c)
target_link_libraries(test_parse PUBLIC eno)
target_link_libraries(test_parse PUBLIC PkgConfig::ICU_IO)
target_link_libraries(test_parse PUBLIC PkgConfig::ICU_UC)