Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of tree builds and a few other miscellaneous CMake cleanups. #242

Merged
merged 7 commits into from
May 11, 2016
Merged

Out of tree builds and a few other miscellaneous CMake cleanups. #242

merged 7 commits into from
May 11, 2016

Commits on May 11, 2016

  1. Configuration menu
    Copy the full SHA
    6a98a6c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bf7b6d1 View commit details
    Browse the repository at this point in the history
  3. 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.
    ChrisKitching committed May 11, 2016
    Configuration menu
    Copy the full SHA
    b6becce View commit details
    Browse the repository at this point in the history
  4. 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.
    ChrisKitching committed May 11, 2016
    Configuration menu
    Copy the full SHA
    4e6aacd View commit details
    Browse the repository at this point in the history
  5. 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...
    ChrisKitching committed May 11, 2016
    Configuration menu
    Copy the full SHA
    af76508 View commit details
    Browse the repository at this point in the history
  6. 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.
    ChrisKitching committed May 11, 2016
    Configuration menu
    Copy the full SHA
    527a69b View commit details
    Browse the repository at this point in the history
  7. Repair appveyor... Horrifyingly

    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 ;)
    ChrisKitching committed May 11, 2016
    Configuration menu
    Copy the full SHA
    0e2f0c4 View commit details
    Browse the repository at this point in the history