json_pointer: allow the feature to be disabled

Some users may not want to included it in their build/system. So allow a
cmake symbol to disable it.

A user can do 'cmake -DDISABLE_JSON_POINTER=ON <json_c_root_dir>' and
disable the json_pointer functionality. That saves about 17 KB (on an
x86_64) machine. This may be useful on smaller embedded systems; even
though the saving would be fewer kilobytes.

One thing that also needs to change a bit, is that the 'json.h' be
autogenerated via cmake, in order to conditionally include that
"json_pointer.h" file.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
Alexandru Ardelean
2021-04-16 09:42:07 +03:00
parent 1f8b64f62c
commit 8abeebc9b2
4 changed files with 18 additions and 5 deletions

View File

@@ -24,7 +24,6 @@ set(ALL_TEST_NAMES
test_double_serializer
test_float
test_int_add
test_json_pointer
test_locale
test_null
test_parse
@@ -37,6 +36,10 @@ set(ALL_TEST_NAMES
test_visit
test_object_iterator)
if (NOT DISABLE_JSON_POINTER)
set(ALL_TEST_NAMES ${ALL_TEST_NAMES} test_json_pointer)
endif()
foreach(TESTNAME ${ALL_TEST_NAMES})
add_executable(${TESTNAME} ${TESTNAME}.c)