CMake: Make building of cJSON_Utils optional

Turned off by default.
This commit is contained in:
Max Bruckner 2016-11-05 22:20:55 +07:00
parent 97b255c736
commit 3353062fc8

View File

@ -44,6 +44,8 @@ set_target_properties(${CJSON_LIB}
VERSION ${CJSON_VERSION}) VERSION ${CJSON_VERSION})
#cJSON_Utils #cJSON_Utils
option(ENABLE_CJSON_UTILS "Enable building the cJSON_Utils library." OFF)
if(ENABLE_CJSON_UTILS)
set(CJSON_UTILS_LIB cjson_utils) set(CJSON_UTILS_LIB cjson_utils)
file(GLOB HEADERS_UTILS cJSON_Utils.h) file(GLOB HEADERS_UTILS cJSON_Utils.h)
@ -63,6 +65,7 @@ set_target_properties(${CJSON_UTILS_LIB}
PROPERTIES PROPERTIES
SOVERSION ${CJSON_UTILS_VERSION_SO} SOVERSION ${CJSON_UTILS_VERSION_SO}
VERSION ${CJSON_VERSION}) VERSION ${CJSON_VERSION})
endif()
option(ENABLE_CJSON_TEST "Enable building cJSON test" ON) option(ENABLE_CJSON_TEST "Enable building cJSON test" ON)
if(ENABLE_CJSON_TEST) if(ENABLE_CJSON_TEST)
@ -70,7 +73,9 @@ if(ENABLE_CJSON_TEST)
add_executable(${TEST_CJSON} test.c) add_executable(${TEST_CJSON} test.c)
target_link_libraries(${TEST_CJSON} ${CJSON_LIB}) target_link_libraries(${TEST_CJSON} ${CJSON_LIB})
if(ENABLE_CJSON_UTILS)
set(TEST_CJSON_UTILS cJSON_test_utils) set(TEST_CJSON_UTILS cJSON_test_utils)
add_executable(${TEST_CJSON_UTILS} test_utils.c) add_executable(${TEST_CJSON_UTILS} test_utils.c)
target_link_libraries(${TEST_CJSON_UTILS} ${CJSON_UTILS_LIB}) target_link_libraries(${TEST_CJSON_UTILS} ${CJSON_UTILS_LIB})
endif() endif()
endif()