Fixed Hunter integration and added tests (#126)

This commit is contained in:
TheMarpe 2020-08-14 09:33:03 +02:00 committed by GitHub
parent 82f962d1e8
commit 1ad9a10b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -67,3 +67,12 @@ script:
- cmake .. -Dnlohmann_json_DIR=.. ${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
- ctest -C Release -V -j
- cd ..
# Remove previous build and tests
- rm -r build
# Compile and execute with Hunter package manager instead of using local json.hpp
- mkdir -p build && cd build
- cmake .. -DHUNTER_ENABLED=ON ${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
- ctest -C Release -V -j
- cd ..

View File

@ -1,3 +1,13 @@
# Add Hunter support (Disabled by default)
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
if(HUNTER_ENABLED)
include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.262.tar.gz"
SHA1 "eb51e633e08cdbe2153caf255e9c23968fecb29d"
)
endif()
project(nlohmann_json_schema_validator
LANGUAGES CXX)
@ -8,13 +18,8 @@ cmake_minimum_required(VERSION 3.2)
option(BUILD_TESTS "Build tests" ON)
option(BUILD_EXAMPLES "Build examples" ON)
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
# Add nlohmann_json::nlohmann_json using Hunter package manager
if(HUNTER_ENABLED)
include(cmake/HunterGate.cmake)
HunterGate(URL https://github.com/cpp-pm/hunter/archive/v0.23.253.tar.gz
SHA1 88ea6d37c897a81a080eb9ae0f69d7807bbb3c73)
# Add nlohmann_json::nlohmann_json (if HUNTER_ENABLED=ON, otherwise command is ignored)
hunter_add_package(nlohmann_json)
endif()