vcpe/srcs/libs/json/json_schema/CMakeLists.txt

42 lines
1.4 KiB
CMake
Raw Normal View History

INCLUDE_DIRECTORIES(../../include/json_schema)
SET(jsoncdac_SOURCES validate.c)
LIST(APPEND OPTIONAL
pattern patternproperties additionalproperties propertynames subschemalogic
contains store ref)
FOREACH (src ${OPTIONAL})
STRING(TOUPPER ${src} srcupper)
OPTION(BUILD_${srcupper} "${src} option" ON)
IF (BUILD_${srcupper})
LIST(APPEND SUPPORTED_OPTIONAL ${src})
SET(jsoncdac_SOURCES ${jsoncdac_SOURCES} ${src}.c)
ADD_DEFINITIONS(-DJDAC_${srcupper})
ENDIF ()
ENDFOREACH ()
IF (BUILD_PATTERNPROPERTIES OR BUILD_PATTERN)
SET(jsoncdac_SOURCES ${jsoncdac_SOURCES} regex_match.c)
#set(EXTRA_LIBS regex)
ENDIF ()
# always supported
LIST(APPEND SUPPORTED_BASE type enum required properties anyOf minLength maxLength minimum maximum const)
LIST(APPEND SUPPORTED_BASE minItems maxItems uniqueItems items)
STRING(REPLACE ";" "," SUPPORTED_BASE_STR "${SUPPORTED_BASE}")
STRING(REPLACE ";" "," SUPPORTED_OPTIONAL_STR "${SUPPORTED_OPTIONAL}")
ADD_LIBRARY(jsoncdac STATIC ${jsoncdac_SOURCES})
TARGET_COMPILE_DEFINITIONS(jsoncdac PRIVATE "SUPPORTED_KEYWORDS_BASE=\"${SUPPORTED_BASE_STR}\"" "SUPPORTED_KEYWORDS_OPTIONAL=\"${SUPPORTED_OPTIONAL_STR}\"")
TARGET_LINK_LIBRARIES(jsoncdac ${EXTRA_LIBS})
SET_TARGET_PROPERTIES(
jsoncdac
PROPERTIES
OUTPUT_NAME jsoncdac
PUBLIC_HEADER "${HEADER_FILES}"
VERSION 0.0.2
SOVERSION 1
)