mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
add an option for ENABLE_CJSON_VERSION_SO in CMakeLists.txt (#534)
Co-authored-by: m00209177 <malihu@huawei.com>
This commit is contained in:
parent
d321fa9e6e
commit
61eb84d991
@ -121,6 +121,7 @@ set(SOURCES cJSON.c)
|
|||||||
option(BUILD_SHARED_AND_STATIC_LIBS "Build both shared and static libraries" Off)
|
option(BUILD_SHARED_AND_STATIC_LIBS "Build both shared and static libraries" Off)
|
||||||
option(CJSON_OVERRIDE_BUILD_SHARED_LIBS "Override BUILD_SHARED_LIBS with CJSON_BUILD_SHARED_LIBS" OFF)
|
option(CJSON_OVERRIDE_BUILD_SHARED_LIBS "Override BUILD_SHARED_LIBS with CJSON_BUILD_SHARED_LIBS" OFF)
|
||||||
option(CJSON_BUILD_SHARED_LIBS "Overrides BUILD_SHARED_LIBS if CJSON_OVERRIDE_BUILD_SHARED_LIBS is enabled" ON)
|
option(CJSON_BUILD_SHARED_LIBS "Overrides BUILD_SHARED_LIBS if CJSON_OVERRIDE_BUILD_SHARED_LIBS is enabled" ON)
|
||||||
|
option(ENABLE_CJSON_VERSION_SO "Enables cJSON so version" ON)
|
||||||
|
|
||||||
if ((CJSON_OVERRIDE_BUILD_SHARED_LIBS AND CJSON_BUILD_SHARED_LIBS) OR ((NOT CJSON_OVERRIDE_BUILD_SHARED_LIBS) AND BUILD_SHARED_LIBS))
|
if ((CJSON_OVERRIDE_BUILD_SHARED_LIBS AND CJSON_BUILD_SHARED_LIBS) OR ((NOT CJSON_OVERRIDE_BUILD_SHARED_LIBS) AND BUILD_SHARED_LIBS))
|
||||||
set(CJSON_LIBRARY_TYPE SHARED)
|
set(CJSON_LIBRARY_TYPE SHARED)
|
||||||
@ -162,10 +163,12 @@ if(ENABLE_TARGET_EXPORT)
|
|||||||
install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties("${CJSON_LIB}"
|
if(ENABLE_CJSON_VERSION_SO)
|
||||||
PROPERTIES
|
set_target_properties("${CJSON_LIB}"
|
||||||
SOVERSION "${CJSON_VERSION_SO}"
|
PROPERTIES
|
||||||
VERSION "${PROJECT_VERSION}")
|
SOVERSION "${CJSON_VERSION_SO}"
|
||||||
|
VERSION "${PROJECT_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
#cJSON_Utils
|
#cJSON_Utils
|
||||||
option(ENABLE_CJSON_UTILS "Enable building the cJSON_Utils library." OFF)
|
option(ENABLE_CJSON_UTILS "Enable building the cJSON_Utils library." OFF)
|
||||||
@ -207,10 +210,12 @@ if(ENABLE_CJSON_UTILS)
|
|||||||
install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/cJSON")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties("${CJSON_UTILS_LIB}"
|
if(ENABLE_CJSON_VERSION_SO)
|
||||||
PROPERTIES
|
set_target_properties("${CJSON_UTILS_LIB}"
|
||||||
SOVERSION "${CJSON_UTILS_VERSION_SO}"
|
PROPERTIES
|
||||||
VERSION "${PROJECT_VERSION}")
|
SOVERSION "${CJSON_UTILS_VERSION_SO}"
|
||||||
|
VERSION "${PROJECT_VERSION}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# create the other package config files
|
# create the other package config files
|
||||||
|
@ -118,6 +118,7 @@ You can change the build process with a list of different options that you can p
|
|||||||
* `-DCMAKE_INSTALL_PREFIX=/usr`: Set a prefix for the installation.
|
* `-DCMAKE_INSTALL_PREFIX=/usr`: Set a prefix for the installation.
|
||||||
* `-DENABLE_LOCALES=On`: Enable the usage of localeconv method. ( on by default )
|
* `-DENABLE_LOCALES=On`: Enable the usage of localeconv method. ( on by default )
|
||||||
* `-DCJSON_OVERRIDE_BUILD_SHARED_LIBS=On`: Enable overriding the value of `BUILD_SHARED_LIBS` with `-DCJSON_BUILD_SHARED_LIBS`.
|
* `-DCJSON_OVERRIDE_BUILD_SHARED_LIBS=On`: Enable overriding the value of `BUILD_SHARED_LIBS` with `-DCJSON_BUILD_SHARED_LIBS`.
|
||||||
|
* `-DENABLE_CJSON_VERSION_SO`: Enable cJSON so version. ( on by default )
|
||||||
|
|
||||||
If you are packaging cJSON for a distribution of Linux, you would probably take these steps for example:
|
If you are packaging cJSON for a distribution of Linux, you would probably take these steps for example:
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user