diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dbb8b5..ae3adb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,19 +74,9 @@ if (HAVE_INTTYPES_H) set(JSON_C_HAVE_INTTYPES_H 1) endif() -if (MSVC) - check_symbol_exists(isnan "math.h" HAVE_DECL_ISNAN) - check_symbol_exists(_isnan "float.h" HAVE_DECL__ISNAN) -else() - check_symbol_exists(isnan "math.h" HAVE_DECL_ISNAN) - check_symbol_exists(_isnan "math.h" HAVE_DECL__ISNAN) -endif() - -if (MSVC) - check_symbol_exists(_finite "float.h" HAVE_DECL__FINITE) -else() - check_symbol_exists(_finite "math.h" HAVE_DECL__FINITE) -endif() +check_symbol_exists(isnan "math.h" HAVE_DECL_ISNAN) +check_symbol_exists(_isnan "float.h" HAVE_DECL__ISNAN) +check_symbol_exists(_finite "float.h" HAVE_DECL__FINITE) check_symbol_exists(INFINITY "math.h" HAVE_DECL_INFINITY) check_symbol_exists(isinf "math.h" HAVE_DECL_ISINF) diff --git a/README.md b/README.md index 3e2f065..53bede9 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ 2. [Building on Unix](#buildunix) 3. [Install Prerequisites](#installprereq) 4. [Building with partial threading support](#buildthreaded) -5. [Linking to libjson-c](#linking) -6. [Using json-c](#using) +5. [Building with CMake](#CMake) +6. [Linking to libjson-c](#linking) +7. [Using json-c](#using) JSON-C - A JSON implementation in C ----------------------------------- @@ -15,8 +16,8 @@ Build Status * [AppVeyor Build](https://ci.appveyor.com/project/hawicz/json-c) ![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/json-c/json-c?branch=master&svg=true) * [Travis Build](https://travis-ci.org/json-c/json-c) ![Travis Build Status](https://travis-ci.org/json-c/json-c.svg?branch=master) -JSON-C implements a reference counting object model that allows you to easily -construct JSON objects in C, output them as JSON formatted strings and parse +JSON-C implements a reference counting object model that allows you to easily +construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects. It aims to conform to [RFC 7159](https://tools.ietf.org/html/rfc7159). @@ -72,7 +73,7 @@ Install prerequisites ----------------------- If you are on a relatively modern system, you'll likely be able to install -the prerequisites using your OS's packaging system. +the prerequisites using your OS's packaging system. ### Install using apt (e.g. Ubuntu 16.04.2 LTS) ```sh @@ -134,6 +135,31 @@ lh_char_hash, uses a compare-and-swap operation to ensure the randomly seed is only generated once. Because this is a one-time operation, it is always compiled in when the compare-and-swap operation is available. +Building with CMake +-------------------- + +To use [CMake](https://cmake.org/cmake-tutorial/), build it like: + +```sh +mkdir build +cd build +cmake ../ +make +``` + +CMake can take a few options. + +Variable | Type | Description +------------------|------|-------------- +BUILD_SHARED_LIBS | Bool | The default build generates static library. Enable this to generate shared (dll/so) library. +ENABLE_RDRAND | Bool | Enable RDRAND Hardware RNG Hash Seed +ENABLE_THREADING | Bool | Enable partial threading support + +Pass these options as `-D` on CMake's command-line. + +```sh +cmake -DBUILD_SHARED_LIBS=On ... +``` Linking to `libjson-c` ----------------------