From cfe0f19cee2435006fa890f92917d3bc73c4f2fc Mon Sep 17 00:00:00 2001 From: vornkat-iis Date: Fri, 9 Aug 2024 17:31:16 +0200 Subject: [PATCH] Make CREADLINE_MAX_LINE_SIZE configurable from CMakeList --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5822f6..ddb8a31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,12 @@ pkg_search_module(JSONC REQUIRED IMPORTED_TARGET json-c) # create an object lib to avoid double compilation add_library(japi_objs OBJECT ${SOURCES} ${HEADERS}) +if(DEFINED CREADLINE_MAX_LINE_SIZE) + if(CREADLINE_MAX_LINE_SIZE LESS 1024) + message(FATAL_ERROR "Minimal linesize is CREADLINE_BLOCK_SIZE=1024 bytes") + endif() + target_compile_definitions(japi_objs PRIVATE CREADLINE_MAX_LINE_SIZE=${CREADLINE_MAX_LINE_SIZE}) +endif() target_compile_options(japi_objs PUBLIC "-pthread" "-D_POSIX_C_SOURCE=200809L") target_include_directories(japi_objs PUBLIC include/ ${JSONC_INCLUDE_DIRS}) set_property(TARGET japi_objs PROPERTY POSITION_INDEPENDENT_CODE ON)