mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
CMake: Use standard variables for the version
This commit is contained in:
parent
de992ec3c9
commit
8a838b37e3
@ -4,12 +4,12 @@ include(GNUInstallDirs)
|
|||||||
|
|
||||||
project(cJSON C)
|
project(cJSON C)
|
||||||
|
|
||||||
set(CJSON_VERSION_MAJOR 1)
|
set(PROJECT_VERSION_MAJOR 1)
|
||||||
set(CJSON_VERSION_MINOR 0)
|
set(PROJECT_VERSION_MINOR 0)
|
||||||
set(CJSON_VERSION_PATCH 0)
|
set(PROJECT_VERSION_PATCH 0)
|
||||||
set(CJSON_VERSION_SO 1)
|
set(CJSON_VERSION_SO 1)
|
||||||
set(CJSON_UTILS_VERSION_SO 1)
|
set(CJSON_UTILS_VERSION_SO 1)
|
||||||
set(CJSON_VERSION "${CJSON_VERSION_MAJOR}.${CJSON_VERSION_MINOR}.${CJSON_VERSION_PATCH}")
|
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
|
|
||||||
if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang"))
|
if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang"))
|
||||||
add_compile_options(-ansi -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings)
|
add_compile_options(-ansi -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings)
|
||||||
@ -18,7 +18,7 @@ endif()
|
|||||||
#variables for pkg-config
|
#variables for pkg-config
|
||||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||||
set(libdir "${CMAKE_INSTALL_LIBDIR}")
|
set(libdir "${CMAKE_INSTALL_LIBDIR}")
|
||||||
set(version "${CJSON_VERSION}")
|
set(version "${PROJECT_VERSION}")
|
||||||
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
|
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||||
@ -44,7 +44,7 @@ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" DESTINATION "${CMAKE_IN
|
|||||||
set_target_properties("${CJSON_LIB}"
|
set_target_properties("${CJSON_LIB}"
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
SOVERSION "${CJSON_VERSION_SO}"
|
SOVERSION "${CJSON_VERSION_SO}"
|
||||||
VERSION "${CJSON_VERSION}")
|
VERSION "${PROJECT_VERSION}")
|
||||||
|
|
||||||
#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)
|
||||||
@ -67,7 +67,7 @@ if(ENABLE_CJSON_UTILS)
|
|||||||
set_target_properties("${CJSON_UTILS_LIB}"
|
set_target_properties("${CJSON_UTILS_LIB}"
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
SOVERSION "${CJSON_UTILS_VERSION_SO}"
|
SOVERSION "${CJSON_UTILS_VERSION_SO}"
|
||||||
VERSION "${CJSON_VERSION}")
|
VERSION "${PROJECT_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# export library information for CMake projects
|
# export library information for CMake projects
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
set(PACKAGE_VERSION "@CJSON_VERSION@")
|
set(PACKAGE_VERSION "@PROJECT_VERSION@")
|
||||||
|
|
||||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||||
|
Loading…
Reference in New Issue
Block a user