Commit Graph

74 Commits

Author SHA1 Message Date
Jehan
8c33d1c3c9 CMakeLists: do not enforce strict prototypes on Windows.
On Windows, or at least when cross-built with Mingw-w64, build fails
because strict prototype fails on an included file (thus nothing we can
do about in json-c code):

> from /home/jehan/dev/src/json-c/json_util.c:44:
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:196:3: error: function declaration isn't a prototype [-Werror=strict-prototypes]
>   196 |   typedef INT_PTR (WINAPI *FARPROC) ();
>       |   ^~~~~~~
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:197:3: error: function declaration isn't a prototype [-Werror=strict-prototypes]
>   197 |   typedef INT_PTR (WINAPI *NEARPROC) ();
>       |   ^~~~~~~
> /home/jehan/.local/share/crossroad/roads/w64/json-c/include/minwindef.h:198:3: error: function declaration isn't a prototype [-Werror=strict-prototypes]
>   198 |   typedef INT_PTR (WINAPI *PROC) ();
>       |   ^~~~~~~

Let's just disable the errors for Windows build.
2020-04-15 13:03:11 +02:00
Björn Esser
053eaa61d7 Fix CMake tests for enforced strict prototypes. 2020-04-14 20:42:32 +02:00
Björn Esser
d0dc3489dc Enforce strict prototypes. 2020-04-13 11:29:52 +02:00
Björn Esser
165e6f58fc CMake: Install pkgconfig file in proper location by default
The default location for pkconfig files on most systems is:
  ${CMAKE_INSTALL_LIBDIR}/pkgconfig

Thus the file should get installed in there by default.
2020-04-12 19:21:54 +02:00
Björn Esser
78cd37fb18 Clean trailing white-space. 2020-04-11 09:41:04 +02:00
Björn Esser
e756777c92 CMake: Check whether BSYMBOLIC is supported by the linker.
Linking with '-Bsymbolic-functions' is supported for ELF-binaries, only.
2020-04-10 17:29:35 +02:00
Björn Esser
58670ec64e CMake: Build Doxygen documentation out-of-tree. 2020-04-10 14:20:57 +02:00
Björn Esser
a989651bd4 CMake: Fix appending of linker flags.
There was a typo in `CMAKE_SHARED_LINKER_FLAGS`.
2020-04-10 14:16:02 +02:00
Eric Haszlakiewicz
545464322b Issue #568: fix the strtoll and strtoull handing so config.h ends up creating defines for those only when needed, which should exclude mingw environments. 2020-04-09 20:58:28 +00:00
Eric Haszlakiewicz
19bbf2c069 Add includes and split off json_types.h to help ensure that headers can be included in any order. 2020-04-06 13:55:27 +00:00
dota17
1204a1fded modify the doc target message 2020-03-19 10:27:27 +08:00
Eric Haszlakiewicz
e94eb90f9f Merge pull request #546 from dota17/make_unistall
Add uninstall target in cmake
2020-03-10 22:12:13 -05:00
dota17
c14c6caa32 delete -r in uninstall 2020-03-11 10:47:04 +08:00
Eric Haszlakiewicz
a8c9284f06 Merge pull request #547 from dota17/assert_test
modify json-c default build type, and fix up the assert() errors in t…
2020-03-03 07:54:21 -06:00
dota17
0030e905b4 modify RELEASE 2020-03-03 14:16:13 +08:00
dota17
e56ab0146f update testcase and delete debug -O0 build 2020-03-02 20:19:35 +08:00
Eric Haszlakiewicz
737aee40c4 Merge pull request #542 from dota17/adduint64_final
add uint64 data to json-c
2020-03-01 08:51:26 -05:00
dota17
2d44f865c3 modify json-c default build type, and fix up the assert() errors in testcase 2020-02-29 15:32:42 +08:00
dota17
1160c8625c Add uninstall target in cmake 2020-02-27 21:02:31 +08:00
dota17
e3b6521baa add doc target on cmake 2020-02-26 18:18:07 +08:00
dota17
77d7a99c75 Increase distcheck target in cmake 2020-02-25 19:15:40 +08:00
dota17
3c3b5920f7 add uint64 data to json-c 2020-02-25 14:51:35 +08:00
Eric Haszlakiewicz
6c55f65d07 Set cmake policy CMP0075, to have check_include_file use the value of CMAKE_REQUIRED_LIBRARIES (currently, adds -lm). See issue #510. 2019-12-06 00:15:14 -05:00
Eric Haszlakiewicz
11a638048d Add a few missing features to the cmake setup that are present in configure.ac:
Include all compiler warnings, and provide DISABLE_WERROR to make them not be errors.
 Define _REENTRANT, if setting it works.
 Set -Bsymbolic-functions, and provide DISABLE_BSYMBOLIC to turn that off.
 Implement the check for HAS_GNU_WARNING_LONG
2019-11-26 23:02:15 -05:00
Eric Haszlakiewicz
a92e6d2c28 Set the soversion in the cmake built library, and arrange for the file name to be generated appropriately too. 2019-11-25 23:26:48 -05:00
Eric Haszlakiewicz
41f434e89f Fix test_util_file for VS2013 too, but skip all the tests for anything older than that because the limitations are too inconvenient. 2019-11-23 23:55:04 -05:00
Eric Haszlakiewicz
f19abcf981 Get the cmake build a bit closer to the autoconf one: include json_visit.h, and fix the version stamped in json-c.pc. 2019-11-23 15:34:23 -05:00
Eric Haszlakiewicz
bdaff94e9a Build and run the tests as part of the cmake build. 2019-11-23 15:15:48 -05:00
myd7349
c2036ab9fc Install CMake module files 2019-05-18 19:44:29 +08:00
Jehan
c46a0636c6 Installation directories empty with CMake in pkg-config.
CMake was not properly substituting the installation dir variables (they
ended up all empty), so the pkg-config results were also wrongs. For
instance cflags was: -I -I/json-c
Even though json-c was found at configure time, this obviously broke the
build of any application using it.
2019-01-26 12:30:40 +01:00
Eric Haszlakiewicz
6460446aa6 Switch to building a dynamic lib by default. Tweak language in the README.md slightly. Inspired by PR#452. 2018-12-11 20:59:08 -05:00
Ivan Romanov
ba5a02e8a9 Allow use json-c cmake as subproject
Now json-c can be bundled to any cmake-based project and used with
couple lines of code:

add_subdirectory(json-c EXCLUDE_FROM_ALL)
target_link_libraries(MyProject json-c)
2018-10-20 10:50:15 +05:00
Eric Haszlakiewicz
994e6c1f60 Re-add creation and installation of the json-c.pc file to the cmake build. 2018-09-01 15:06:14 -04:00
changyong guo
08c8231cc8 fix c flag loss during cmake building 2018-08-14 13:52:18 +08:00
Unmanned Player
f2e991a341 The real CMake support
This patch provides a CMakeLists.txt file to build JSON-C library without relying on auto-tools support. This makes the build a bit more portable and cleaner.

It can detect headers and symbols and generate config.h header file based on those detections. It cannot yet handle ctest(1) as the testing itself depends on comparing the output against files. Testing would need some creative abuse of CMake :) This will be provided a few patches later and may possibly involve refactoring test cases.

The patch has been tested on GCC 4.8.5 (Linux), GCC 7.2.0 (MinGW) and Microsoft Visual C++ 16.0 (2010?) locally. Also, compiles correctly on Travis CI and AppVeyor without errors.
2018-07-24 08:06:13 +10:00
Alexander Dahl
901d59b29f cmake: Bump required version
Using 'project(foo VERSION 1.0)' requires CMake 3.0, the VERSION option
is not part of CMake 2.8.7, see:

* https://cmake.org/cmake/help/v2.8.7/cmake.html#command:project
* https://cmake.org/cmake/help/v3.0/release/3.0.0.html#commands

The property C_STANDARD was introduced with CMake 3.1, see:

* https://cmake.org/cmake/help/v3.1/release/3.1.0.html#properties

Signed-off-by: Alexander Dahl <post@lespocky.de>
2018-07-12 21:25:38 +02:00
Eric Haszlakiewicz
3df1f98b4a Explain why we're not setting the output name for static libraries when on Windows. 2018-06-23 22:10:55 -04:00
Eric Haszlakiewicz
a056893263 Merge pull request #415 from sgbihu/master
Resolve windows name conflict
2018-06-23 22:08:25 -04:00
Keith Holman
37a2edf468 install json_object_iterator.h header file
When building the project using cmake then installing it.  The
definitions in `json_object_iterator.h` are required but not installed
by the cmake install rule.  This patch adds the `json_object_iterator.h`
file to the list of files to install.

Signed-off-by: Keith Holman <keith.holman@windriver.com>
2018-06-07 13:19:27 -04:00
Eric Haszlakiewicz
4414d068b3 Always create debug info (pdb file) even for release builds. 2018-05-27 21:50:57 -04:00
Liang, Gao
0b3616d580 Resolve windows name conflict
1. The windows dll will output the lib and dll, and rename the static
    lib will have conflict on windows.
2. Delete rename code to dismiss the conflict.
2018-05-21 16:34:13 +08:00
Eric Haszlakiewicz
0631c37c7f Update the master branch to version 0.13.99 2017-12-09 14:59:48 -05:00
Eric Haszlakiewicz
cf913621f1 Use cmake to create the json-c.pc file, as suggested by PR#362. 2017-10-09 13:16:00 -04:00
Eric Haszlakiewicz
579f0746f0 Issue #173, follow up to using strtoll to allow this to work on older Windows environments: Use cmake to generate config.h from config.h.win32, including checking for strtoll with cmake, or fall back to _strtoi64 for older MSVC's.
Also, add a few missing files to the list of sources to build.
2017-10-03 22:50:29 -04:00
Eric Haszlakiewicz
66a77d129a Split the list of cmake headers into public and private ones, and only install the public ones. 2017-09-17 21:27:07 -04:00
Eric Haszlakiewicz
7e608c5728 Issue #359: Use consistent spacing in CMakeLists.txt 2017-09-06 23:42:38 -04:00
Haffon
837a249f01 set JSON_C_HEADERS full file name 2017-09-07 10:39:14 +08:00
Haffon
95e174e2fb Merge pull request #1 from json-c/master
want to merge the original repository
2017-08-30 00:02:59 +08:00
Haffon
3141c3976b 1.make it can been compiled with Visual Studio 2010
2.replace json_object_get/put API with json_object_retain/release, as they operate the reference counter, and confused with array_list_get/put_idx.
3.replace array_list_get/put_idx API with array_list_get/insert to make them more clear to use.
2017-08-22 13:53:47 +08:00
topilski
0a99e7a5c1 Fix Mingw build 2017-07-30 07:37:17 +03:00