diff --git a/components/jsmn/CMakeLists.txt b/components/jsmn/CMakeLists.txt index 0c7a0ab99e..d05badb215 100644 --- a/components/jsmn/CMakeLists.txt +++ b/components/jsmn/CMakeLists.txt @@ -1,2 +1,10 @@ idf_component_register(SRCS "src/jsmn.c" INCLUDE_DIRS "include") + +if(CONFIG_JSMN_PARENT_LINKS) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DJSMN_PARENT_LINKS") +endif() + +if(CONFIG_JSMN_STRICT) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DJSMN_STRICT") +endif() diff --git a/components/jsmn/component.mk b/components/jsmn/component.mk index 96190be500..88f1a9564f 100644 --- a/components/jsmn/component.mk +++ b/components/jsmn/component.mk @@ -4,3 +4,11 @@ COMPONENT_ADD_INCLUDEDIRS := include/ COMPONENT_SRCDIRS := src/ + +ifdef CONFIG_JSMN_PARENT_LINKS +src/jsmn.o: CPPFLAGS += -DJSMN_PARENT_LINKS +endif + +ifdef CONFIG_JSMN_STRICT +src/jsmn.o: CPPFLAGS += -DJSMN_STRICT +endif diff --git a/components/jsmn/include/jsmn.h b/components/jsmn/include/jsmn.h index 73ef957990..1df808e394 100644 --- a/components/jsmn/include/jsmn.h +++ b/components/jsmn/include/jsmn.h @@ -37,9 +37,6 @@ extern "C" { #endif -#define JSMN_PARENT_LINKS CONFIG_JSMN_PARENT_LINKS -#define JSMN_STRICT CONFIG_JSMN_STRICT - /** * JSON type identifier. Basic types are: * o Object