Out of tree builds and a few other miscellaneous CMake cleanups.#242
Merged
nlohmann merged 7 commits intonlohmann:developfrom May 11, 2016
ChrisKitching:outOfTree
Merged
Out of tree builds and a few other miscellaneous CMake cleanups.#242nlohmann merged 7 commits intonlohmann:developfrom ChrisKitching:outOfTree
nlohmann merged 7 commits intonlohmann:developfrom
ChrisKitching:outOfTree
Conversation
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.
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.
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...
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.
Owner
|
Hi @ChrisKitching, could you please check why the AppVeyor build is broken? |
Owner
|
(Apart from this, I have not checked the details of the changes) |
It's sort of gnarly that it's still doing in-tree builds, but I really, _really_ don't want to get any more friendly with CMake's Visual Studio generator to work out how to make it stop doing it. In-tree builds still work, after all, and the goal of this work is to make out-of-tree builds work as well. Notional horrors like this will have to wait ;)
Contributor
Author
|
There we go. Builds on Windows are officially my least favourite thing. |
Owner
|
Thanks! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the stuff I raised in #241. Hopefully this isn't too invasive for you...
I'll attempt to find some time to do more cleanup in the coming days.