Commit Graph

3496 Commits

Author SHA1 Message Date
Chris Kitching
527a69bb64
Install the test binary and test data. Fixes #241
The resulting install tree, when tests are enabled, looks like this:

```
.
├── cmake
│   ├── nlohmann_jsonConfig.cmake
│   ├── nlohmann_jsonConfigVersion.cmake
│   └── nlohmann_jsonTargets.cmake
├── include
│   └── nlohmann
│       └── json.hpp
└── test
    ├── bin
    │   └── json_unit
    └── data
        ├── json_nlohmann_tests
        │   ├── all_unicode.json
        │   └── bom.json
        ├── json.org
        │   ├── 1.json
        │   ├── ...
        ├── json_roundtrip
        │   ├── roundtrip01.json
        │   ├── roundtrip02.json
        │   └── ...
        ├── json_tests
        │   ├── fail10.json
        │   └── ...
        └── json_testsuite
            └── sample.json
```

It has the property that you can invoke the test binary from the
root of the install tree and the tests work correctly (you no
longer depend on the test binary being run inside the source
tree).

If tests are disabled, the entire `test/` subtree is omitted.
Notice how that yields exactly what you want for using this
library in other projects.

I do not believe I need to update travis due to this change, as the
evil Makefile continues to do in-tree builds. I expect I'll find
out soon enough.
2016-05-11 01:43:42 +01:00
Chris Kitching
af76508fe7
Introduce structure to the test/ directory
This introduces a clear separation between test data and test
binaries. Test data is moved into test/data, and the test binaries
move into test/src. A new CMake script specific to building the
tests is introduced in /test to slightly clean up the toplevel
one.

As well as tidying things up, this makes the next step trivial...
2016-05-11 01:30:08 +01:00
Chris Kitching
4e6aacda36
Use definitely-unique target/project name
There exist lots of json libraries, and project/target names must
be globally unique. If someone integrated with this library in a
particularly stupid way, using a generic name like "json" might
cause a problem.
2016-05-11 01:14:56 +01:00
Chris Kitching
b6becce8fb
Don't use variable for the test target name
I'm not sure that using a variable for target names really helps
with clarity. Unlike paths, target names aren't really something
you change. In a sense, targets are themselves a sort of variable,
so having a variable to name a variable seems just a bit gnarly.
2016-05-11 01:12:56 +01:00
Chris Kitching
bf7b6d15c7
Unset execute bit on sample.json 2016-05-11 01:10:29 +01:00
Chris Kitching
6a98a6c964
Add CMake option to disable building the tests (Default builds) 2016-05-11 01:06:32 +01:00
Niels
9ecf83f630 working on #235 2016-05-08 20:28:20 +02:00
Niels
6d8e00ade8 another try to remove a warning 2016-05-08 17:17:17 +02:00
Niels
ac3036dc0f Merge branch 'develop' into feature/issue239 2016-05-08 17:07:08 +02:00
Niels
fadf286653 added test case for std::bad_alloc 2016-05-08 14:35:32 +02:00
Niels
85a30813c8 removed unnecessary code (numbers must not begin with "+") 2016-05-07 20:22:58 +02:00
Niels
688cd49bdc Merge branch 'feature/json-patch' into develop 2016-05-07 18:41:02 +02:00
Niels
c04275966f improved test coverage 2016-05-07 18:33:43 +02:00
Niels
9073b2ca39 hopefully removed some warnings 2016-04-30 16:22:27 +02:00
Niels
ea84a85b13 simplified flatten/unflatten examples 2016-04-30 10:39:03 +02:00
Niels
a21f8b0c77 added AppVeyor information 2016-04-30 01:21:35 +02:00
Niels
9170740f45 added documentation on Travis compilers 2016-04-30 01:01:41 +02:00
Niels
7c04bc3db6 added name call 2016-04-30 00:43:33 +02:00
Niels
be16d005e4 get compiler versions 2016-04-30 00:25:11 +02:00
Niels
f4ecceab19 cleanup 2016-04-30 00:12:19 +02:00
Niels
1d3b4dd158 added test cases 2016-04-30 00:03:47 +02:00
Niels
62f81a60d7 hopefully fixed a warning 2016-04-29 21:23:13 +02:00
Niels
82f5332cf4 Merge branch 'develop' into feature/json-patch 2016-04-29 20:50:34 +02:00
Niels
74544b42af removed MinGW compiler (too old) 2016-04-29 20:48:47 +02:00
Niels
c019088d3b wrong MinGW binary 2016-04-29 20:35:40 +02:00
Niels
b685737d53 added MinGW 2016-04-29 20:18:20 +02:00
Niels
ddc5442c91 cleanup 2016-04-29 20:09:41 +02:00
Niels
a07cdb14ec don't install valgrind for OSX 2016-04-29 20:01:11 +02:00
Niels
40abeb28d5 Valgrind only for Linux 2016-04-29 20:00:33 +02:00
Niels
68c50073a4 added OSX 2016-04-29 19:46:37 +02:00
Niels
ca604c5a2e trying Clang 3.9 2016-04-29 19:37:52 +02:00
Niels
86d7e3090f removed GCC 6, added Clang 3.5 2016-04-29 19:33:43 +02:00
Niels
e35805cf3a added GCC 6 and Clang 3.8 to Travis 2016-04-29 19:29:02 +02:00
Niels
86debab3b1 Merge branch 'develop' into feature/json-patch 2016-04-26 20:43:02 +02:00
Niels
9af8f7d094 update after #238 2016-04-26 20:38:01 +02:00
Niels
7dc07b75de Merge branch 'develop' into feature/json-patch 2016-04-26 20:32:24 +02:00
Niels
0f64761663 Merge pull request #238 from robertmrk/cmake-package
Implement additional integration options
2016-04-26 20:31:19 +02:00
Niels
5e0bf75d60 cleanup, test, and diff 2016-04-25 23:17:04 +02:00
Robert Marki
192a692034 Generate package config files in cmake's current binary directory
Generate the config files of the package in CMAKE_CURRENT_BINARY_DIR
instead of CMAKE_BINARY_DIR because the later will refer to the main
project's binary directory if the library is included in the project
using the add_subdirectory command.
2016-04-25 11:55:03 +02:00
Robert Marki
b1a2e9a715 Create an install target for the project
- define the project's version in the cmake listfile
- create a config and config version file for the cmake package
- install the json.hpp file and the package's targets, config and
config version files
2016-04-25 10:27:19 +02:00
Robert Marki
30e396043a Export library target and store build directory in package registry 2016-04-25 09:36:05 +02:00
Robert Marki
28f73ed406 Refactor CMake listfile to define an interface imported library
Define the library as an interface imported library so other targets
can use the library as a dependency and use the interface properties
of the library.
2016-04-24 19:56:20 +02:00
Niels
96cfe7463f fixed some warnings 2016-04-24 19:09:12 +02:00
Niels
8d4cf5ef8d oops 2016-04-24 19:04:10 +02:00
Niels
fb54e212b6 clean up and added tests 2016-04-24 19:03:33 +02:00
Niels
09e9f6dcd4 implemented "move" 2016-04-24 17:43:27 +02:00
Niels
855cf2307b extended "add" to cope with arrays 2016-04-24 16:51:06 +02:00
Niels
397ada22d3 implemented remove 2016-04-20 16:52:00 +02:00
Niels
fa03cf0c63 replace and copy 2016-04-20 15:41:33 +02:00
Niels
70fc5835cb started implementing JSON Patch (RFC 6902) 2016-04-18 22:41:36 +02:00