Now when json-schema-validator is installed CMake config files are installed in the lib/cmake/json-schema-validator directory. The install json-schema-validatorTargets.cmake file properly imports the json-hpp and json-schema-validator libraries. The install json-schema-validatorConfig.cmake file is used by CMake find_package function to include the json-schema-validatorTargets.cmake file and to set the variable JSON_SCHEMA_VALIDATOR_INCLUDE_DIRS to the install include directory. To use find_package to find the json-schema-validator simply include. A new test (test_cmake_install) has been added. When NLohmann's JSON is install with CMake, it follows a certain naming convention. As we learned to do proper CMake-install thanks to @lkersting's work this project now adapts to the way NLohmann is doing it. Namely: - json-schema.hpp is now located (and installed) in a nlohmann/-subdirectory - the CMake library and project's name is now nlohmann_json_schema_validator Instead of doing non-standard acrobatics to find the json.hpp now find_package is used in order to find NLohmann's package Co-Authored-By: Patrick Boettcher <p@yai.se>
70 lines
1.5 KiB
YAML
70 lines
1.5 KiB
YAML
#########################
|
|
# project configuration #
|
|
#########################
|
|
|
|
# C++ project
|
|
language: cpp
|
|
|
|
dist: trusty
|
|
sudo: required
|
|
group: edge
|
|
|
|
matrix:
|
|
include:
|
|
- os: linux
|
|
compiler: gcc
|
|
env: COMPILER=g++-4.9
|
|
addons:
|
|
apt:
|
|
sources: ['ubuntu-toolchain-r-test']
|
|
packages: ['g++-4.9', 'ninja-build']
|
|
|
|
- os: linux
|
|
compiler: gcc
|
|
env: COMPILER=g++-5
|
|
addons:
|
|
apt:
|
|
sources: ['ubuntu-toolchain-r-test']
|
|
packages: ['g++-5', 'ninja-build']
|
|
|
|
- os: linux
|
|
compiler: gcc
|
|
env: COMPILER=g++-6
|
|
addons:
|
|
apt:
|
|
sources: ['ubuntu-toolchain-r-test']
|
|
packages: ['g++-6', 'ninja-build']
|
|
|
|
- os: linux
|
|
compiler: gcc
|
|
env: COMPILER=g++-7
|
|
addons:
|
|
apt:
|
|
sources: ['ubuntu-toolchain-r-test']
|
|
packages: ['g++-7', 'ninja-build']
|
|
|
|
script:
|
|
# get CMake and Ninja (only for systems with brew - macOS)
|
|
- |
|
|
if [[ (-x $(which brew)) ]]; then
|
|
brew update
|
|
brew install cmake ninja
|
|
brew upgrade cmake
|
|
fi
|
|
# make sure CXX is correctly set
|
|
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
|
|
|
|
# show OS/compiler version
|
|
- uname -a
|
|
- cmake --version
|
|
- $CXX --version
|
|
|
|
# put json.hpp to nlohmann
|
|
- mkdir -p nlohmann && wget https://github.com/nlohmann/json/releases/download/v3.6.0/json.hpp -O nlohmann/json.hpp
|
|
|
|
# compile and execute unit tests
|
|
- mkdir -p build && cd build
|
|
- cmake .. -Dnlohmann_json_DIR=.. ${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
|
|
- ctest -C Release -V -j
|
|
- cd ..
|