-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from DaveGamble/v1
Release version 1.0.0
- Loading branch information
Showing
11 changed files
with
575 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ test | |
*.patch | ||
tags | ||
*.dylib | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,110 @@ | ||
set(CMAKE_LEGACY_CYGWIN_WIN32 0) | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
set(PROJ_CJSON cJSON) | ||
include(GNUInstallDirs) | ||
|
||
project(${PROJ_CJSON} C) | ||
project(cJSON C) | ||
|
||
set(PROJECT_VERSION_MAJOR 1) | ||
set(PROJECT_VERSION_MINOR 0) | ||
set(PROJECT_VERSION_PATCH 0) | ||
set(CJSON_VERSION_SO 1) | ||
set(CJSON_UTILS_VERSION_SO 1) | ||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") | ||
|
||
option(ENABLE_CUSTOM_COMPILER_FLAGS ON) | ||
if (ENABLE_CUSTOM_COMPILER_FLAGS) | ||
if(("${CMAKE_C_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89 -pedantic -Wall -Wextra -Werror -Wstrict-prototypes -Wwrite-strings") | ||
endif() | ||
endif() | ||
|
||
#variables for pkg-config | ||
set(prefix "${CMAKE_INSTALL_PREFIX}") | ||
set(libdir "${CMAKE_INSTALL_LIBDIR}") | ||
set(version "${PROJECT_VERSION}") | ||
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}") | ||
|
||
option(BUILD_SHARED_LIBS "Build shared libraries" ON) | ||
option(ENABLE_TARGET_EXPORT "Enable exporting of CMake targets. Disable when it causes problems!" ON) | ||
|
||
#cJSON | ||
set(CJSON_LIB cjson) | ||
|
||
file(GLOB HEADERS cJSON.h) | ||
set(SOURCES cJSON.c) | ||
|
||
add_library(${PROJ_CJSON} ${HEADERS} ${SOURCES}) | ||
add_library("${CJSON_LIB}" "${HEADERS}" "${SOURCES}") | ||
if (NOT WIN32) | ||
target_link_libraries(${PROJ_CJSON} m) | ||
target_link_libraries("${CJSON_LIB}" m) | ||
endif() | ||
|
||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libcjson.pc.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" @ONLY) | ||
|
||
install(FILES cJSON.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cjson") | ||
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | ||
install(TARGETS "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT "${CJSON_LIB}") | ||
if(ENABLE_TARGET_EXPORT) | ||
# export library information for CMake projects | ||
install(EXPORT "${CJSON_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON") | ||
endif() | ||
|
||
set(PROJ_CJSON_UTILS cJSON_utils) | ||
set_target_properties("${CJSON_LIB}" | ||
PROPERTIES | ||
SOVERSION "${CJSON_VERSION_SO}" | ||
VERSION "${PROJECT_VERSION}") | ||
|
||
#cJSON_Utils | ||
option(ENABLE_CJSON_UTILS "Enable building the cJSON_Utils library." OFF) | ||
if(ENABLE_CJSON_UTILS) | ||
set(CJSON_UTILS_LIB cjson_utils) | ||
|
||
file(GLOB HEADERS_UTILS cJSON_Utils.h) | ||
set(SOURCES_UTILS cJSON_Utils.c) | ||
|
||
project(${PROJ_CJSON_UTILS} C) | ||
add_library("${CJSON_UTILS_LIB}" "${HEADERS_UTILS}" "${SOURCES_UTILS}") | ||
target_link_libraries("${CJSON_UTILS_LIB}" "${CJSON_LIB}") | ||
|
||
file(GLOB HEADERS_UTILS cJSON_Utils.h) | ||
set(SOURCES_UTILS cJSON_Utils.c) | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libcjson_utils.pc.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/libcjson_utils.pc" @ONLY) | ||
|
||
install(TARGETS "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}" EXPORT "${CJSON_UTILS_LIB}") | ||
install(FILES cJSON_Utils.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cjson") | ||
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/libcjson_utils.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | ||
if(ENABLE_TARGET_EXPORT) | ||
# export library information for CMake projects | ||
install(EXPORT "${CJSON_UTILS_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON") | ||
endif() | ||
|
||
set_target_properties("${CJSON_UTILS_LIB}" | ||
PROPERTIES | ||
SOVERSION "${CJSON_UTILS_VERSION_SO}" | ||
VERSION "${PROJECT_VERSION}") | ||
endif() | ||
|
||
add_library(${PROJ_CJSON_UTILS} ${HEADERS_UTILS} ${SOURCES_UTILS}) | ||
target_link_libraries(${PROJ_CJSON_UTILS} ${PROJ_CJSON}) | ||
# create the other package config files | ||
configure_file( | ||
cJSONConfig.cmake.in | ||
${PROJECT_BINARY_DIR}/cJSONConfig.cmake @ONLY) | ||
configure_file( | ||
cJSONConfigVersion.cmake.in | ||
${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake @ONLY) | ||
|
||
install (TARGETS ${PROJ_CJSON} DESTINATION lib${LIB_SUFFIX}) | ||
install (FILES cJSON.h DESTINATION include/cJSON) | ||
install (TARGETS ${PROJ_CJSON_UTILS} DESTINATION lib${LIB_SUFFIX}) | ||
install (FILES cJSON_Utils.h DESTINATION include/cJSON) | ||
# Install package config files | ||
install(FILES ${PROJECT_BINARY_DIR}/cJSONConfig.cmake | ||
${PROJECT_BINARY_DIR}/cJSONConfigVersion.cmake | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cJSON") | ||
|
||
option(ENABLE_CJSON_TEST "Enable building cJSON test" OFF) | ||
option(ENABLE_CJSON_TEST "Enable building cJSON test" ON) | ||
if(ENABLE_CJSON_TEST) | ||
set(TEST_CJSON cJSON_test) | ||
add_executable(${TEST_CJSON} test.c) | ||
target_link_libraries(${TEST_CJSON} ${PROJ_CJSON}) | ||
set(TEST_CJSON cJSON_test) | ||
add_executable("${TEST_CJSON}" test.c) | ||
target_link_libraries("${TEST_CJSON}" "${CJSON_LIB}") | ||
|
||
set(TEST_CJSON_UTILS cJSON_test_utils) | ||
add_executable(${TEST_CJSON_UTILS} test_utils.c) | ||
target_link_libraries(${TEST_CJSON_UTILS} ${PROJ_CJSON_UTILS}) | ||
if(ENABLE_CJSON_UTILS) | ||
set(TEST_CJSON_UTILS cJSON_test_utils) | ||
add_executable("${TEST_CJSON_UTILS}" test_utils.c) | ||
target_link_libraries("${TEST_CJSON_UTILS}" "${CJSON_UTILS_LIB}") | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Contributors | ||
============ | ||
|
||
* [Ajay Bhargav](https://github.com/ajaybhargav) | ||
* [Anton Sergeev](https://github.com/anton-sergeev) | ||
* [Christian Schulze](https://github.com/ChristianSch) | ||
* [Dave Gamble](https://github.com/DaveGamble) | ||
* [dieyushi](https://github.com/dieyushi) | ||
* [Dongwen Huang (黄东文)](https://github.com/DongwenHuang) | ||
* Eswar Yaganti | ||
* [Evan Todd](https://github.com/etodd) | ||
* [Fabrice Fontaine](https://github.com/ffontaine) | ||
* Ian Mobley | ||
* Irwan Djadjadi | ||
* [IvanVoid](https://github.com/npi3pak) | ||
* [Jonathan Fether](https://github.com/jfether) | ||
* [Kevin Branigan](https://github.com/kbranigan) | ||
* [Linus Wallgren](https://github.com/ecksun) | ||
* [Max Bruckner](https://github.com/FSMaxB) | ||
* Mike Pontillo | ||
* Paulo Antonio Alvarez | ||
* [Rafael Leal Dias](https://github.com/rafaeldias) | ||
* [Rod Vagg](https://github.com/rvagg) | ||
* [Roland Meertens](https://github.com/rmeertens) | ||
* [Weston Schmidt](https://github.com/schmidtw) | ||
|
||
And probably more people on [SourceForge](https://sourceforge.net/p/cjson/bugs/search/?q=status%3Aclosed-rejected+or+status%3Aclosed-out-of-date+or+status%3Awont-fix+or+status%3Aclosed-fixed+or+status%3Aclosed&page=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.