Commit Graph

66 Commits

Author SHA1 Message Date
Cameron Lowell Palmer
904f5c28ac CMake variable to number comparison changed to provide meaningful error
message.  Explicitly specify STATIC and PIC
2018-05-18 10:35:05 +02:00
Petri Lehtinen
80cea73bf9
Merge pull request #408 from isaachier/cmake
CMake improvements, make package relocatable
2018-05-18 08:08:32 +03:00
Maxim Zhukov
50f29f9b1a Add JSON_HAVE_SYNC_BUILTINS and JSON_HAVE_ATOMIC_BUILTINS for autoheader
Added JSON_HAVE_SYNC_BUILTINS and JSON_HAVE_ATOMIC_BUILTINS defines to
jansson_config.h.cmake as well as in the autoheader for autoconf.
2018-03-22 17:46:29 +03:00
Isaac Hier
2c98c30a02 Stop using absolute paths 2018-03-11 10:54:24 -04:00
Isaac Hier
bb71db204f Fix output file name for version config 2018-03-11 10:54:14 -04:00
Isaac Hier
92760bb363 Remove warning 2018-03-11 10:54:02 -04:00
Isaac Hier
fe7873e963 Fix package version config generation 2018-03-11 10:37:15 -04:00
Isaac Hier
a586c0654f Fix CMake include 2018-03-11 10:27:48 -04:00
Isaac Hier
6d7a02beb0 Clean up CMake install 2018-03-11 10:24:27 -04:00
Isaac Hier
b70364b362 Remove absolute path references 2018-03-11 10:11:09 -04:00
Isaac Hier
a324d18940 Rename target file 2018-03-11 09:53:06 -04:00
Isaac Hier
44f6606df8 Rename config files 2018-03-11 09:47:29 -04:00
Isaac Hier
d8798468c6 Upgrade CMake to 3.1 for Hunter 2018-03-11 09:34:45 -04:00
Corey Farrell
749bef0b6a More test coverage.
* Add test_load_callback to CMakeList.txt
* Add json_dump, json_load and json_unpack chaos testing.
2018-03-06 23:28:14 -05:00
Corey Farrell
73c22de516 Improve test coverage.
* Test equality of different length strings.
* Add tab to json_pack whitespace test.
* Test json_sprintf with empty result and invalid UTF.
* Test json_get_alloc_funcs with NULL arguments.
* Test invalid arguments.
* Add test_chaos to test allocation failure code paths.
* Remove redundant json_is_string checks from json_string_equal and
  json_string_copy.  Both functions are static and can only be called
  with a json string.

Fixes to issues found by test_chaos:
* Fix crash on OOM in pack_unpack.c:read_string().
* Unconditionally free string in string_create upon allocation failure.
  Update load.c:parse_value() to reflect this.  This resolves a leak on
  allocation failure for pack_unpack.c:pack_string() and
  value.c:json_sprintf().

Although not visible from CodeCoverage these changes significantly
increase branch coverage.  Especially in src/value.c where we previously
covered 67.4% of branches and now cover 96.3% of branches.
2018-02-15 10:12:31 -05:00
Corey Farrell
744fe5ed44 jansson 2.11 2018-02-09 12:31:18 -05:00
Petri Lehtinen
248d62111c
Merge pull request #368 from AmeyaVS/cmake_build_fix
Fix generated `pkg-config` file using cmake.
2018-02-09 09:45:36 +02:00
Petri Lehtinen
efe6c7b3f2 Add json_sprintf and json_vsprintf
Fixes #392
2018-02-09 07:37:33 +02:00
Corey Farrell
dc3b313e91 Use thread-safe reference counting if supported by the compiler.
This makes use of __atomic or __sync builtin compiler functions to make
json_decref and json_incref thread-safe.

Issue #387
2018-01-29 14:17:58 -05:00
Joe Hura
0b04762c94 Fixes akheron/jansson#373
'sys/time.h' is a typo, it should read: 'sys/types.h'
2017-11-07 19:32:14 +11:00
Ameya Vikram Singh
89f0dde7ff Fix generated pkg-config file using cmake.
Fixed the generated `jansson.pc` with cmake to be consistent with the
one generated using GNU Autotools.
2017-10-29 23:57:25 +05:30
Petri Lehtinen
17f77cf2c6 CMakeLists.txt: Remove extra parenthesis
Fixes #333
2017-03-29 07:08:19 +03:00
Nathaniel McCallum
b23201bb1a jansson 2.10 2017-03-02 20:49:42 +02:00
Brian Armstrong
2af820fb99 parens for LONG_LONG_INT in cmake
when this is defined as "", cmake bails with an error about arguments in
if
2016-11-12 18:58:38 -08:00
Petri Lehtinen
b02db47881 jansson 2.9 2016-09-18 14:35:05 +03:00
Matthew Johnston
9258671924 Add install targets to be optional 2016-09-11 00:04:49 -05:00
Petri Lehtinen
012c5f0eca jansson 2.8 2016-08-30 21:09:28 +03:00
Petri Lehtinen
72fd2fec4c Simplify snprintf and vsnprintf checking for Visual Studio 2016-05-30 11:51:39 +03:00
Thanabodee Charoenpiriyakij
9d71d006cc Fix libdir is wrong when compile with cmake
because JANSSON_INSTALL_LIB_DIR is set to /usr/local/lib after
foreach loop
2016-02-10 18:46:43 +07:00
Joakim Soderberg
d0a8ad4c06 Compile simple_parse example for CMake project. 2015-01-13 16:17:48 +01:00
Petri Lehtinen
890760b2fb Increase test coverage 2014-12-19 08:35:46 +02:00
Petri Lehtinen
abaae7630e Make it possible to set initial hashtable size
Fixes #213.
2014-12-18 14:43:44 +02:00
Joakim Söderberg
19f33c0e71 Add support for coverage/coveralls.io in cmake project.
This adds support for http://coveralls.io/ to the cmake project. This can then be run via a new Travis job, which uploads json containing the coverage data to the website.

To use this, please login usin github at http://coveralls.io/ and enable the Jansson project. You can then get a nice percentage badge for code coverage after each Travis buid. Coveralls will also comment on pull request with coverage info.

To test and run it locally do:

```bash
$ mkdir build && cd build
$ cmake -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug ..
$ cmake --build .                      # $ make
$ cmake --build . --target coveralls   # $ make coveralls
```

There is also another script that generates a local HTML page using lcov CodeCoverage.cmake which can be run using

```bash
$ make coverage
```

The required depdencies to run this are:
gcov
curl
lcov (is needed for the normal CodeCoverage script)
2014-12-12 23:57:01 +01:00
Christian Ullrich
b52e7a69aa Fix CFLAGS for static-CRT build.
Setting the variables to only "/MT(d)" resets all other flags to their defaults, so the debug build used release flags.
2014-10-13 13:06:02 +02:00
Christian Ullrich
1395e4303a Fix static CRT selection. 2014-10-13 13:04:04 +02:00
Petri Lehtinen
ee27b7e3dd jansson 2.7 2014-10-02 13:10:45 +03:00
Petri Lehtinen
348401e7b8 CMake: Use add_definitions for compiler flags
Fixes #193.
2014-07-02 22:04:34 +03:00
Petri Lehtinen
5b88cc5ded Merge branch '2.6' 2014-04-30 12:06:03 +03:00
Petri Lehtinen
db285b3764 Check uint16_t and uint8_t support correctly
Fixes #177.
2014-04-30 12:05:51 +03:00
Petri Lehtinen
1dc87ed5a1 Make valgrind happy 2014-02-12 08:54:26 +02:00
Petri Lehtinen
50a811ca07 Fix feature checks to use correct __ATOMIC flags 2014-02-12 08:54:26 +02:00
Petri Lehtinen
4bbb53a25d Make valgrind happy 2014-02-12 08:54:06 +02:00
Petri Lehtinen
569295fe30 Fix feature checks to use correct __ATOMIC flags 2014-02-12 08:44:29 +02:00
Petri Lehtinen
17ec22f514 Merge branch '2.6' 2014-02-11 14:49:15 +02:00
Petri Lehtinen
e83ded066a jansson 2.6 2014-02-11 09:45:30 +02:00
Petri Lehtinen
8f80c2d838 CVE-2013-6401: Change hash function, randomize hashes
Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing
and testing.
2014-02-11 08:41:30 +02:00
Joakim Soderberg
7c80778827 Fix so that valgrind checks actually works with CMake.
The valgrind tests where not run on the suites.

And valgrind was always returning 0 so set an explicit exit code on exit. I also had forgotten to change the name of TEST_WITH_VALGRIND to JANSSON_TEST_WITH_VALGRIND so that the tests would never use valgrind.
2014-01-28 13:07:59 +00:00
Joakim Soderberg
0c95a22888 Make sure the private config is included. 2014-01-28 09:59:43 +01:00
Joakim Soderberg
3fe8f74e7f Renamed config.h -> jansson_private_config.h
This is because it's really easy to get a name collission if compiling
Jansson as a subproject in a larger CMake project. If one project includes
several subprojects each having their own config.h, this will cause the
wrong file to be loaded.
2014-01-27 12:48:52 +01:00
Joakim Soderberg
913937c98d Added CMake config files.
This will simplify linking against the lib, both from the build-tree and
install-tree from other CMake projects.

CMakes find_package command uses these configs to locate the exported
targets for the library.

* Also changed so that all CMake options for the project are prepended
  with JANSSON_ so that there is no ambiguity when including this as a
  subdirectory in another CMake project.
2014-01-24 14:13:02 +01:00