Skip to content

Commit 1ad9a10

Browse files
authored
Fixed Hunter integration and added tests (#126)
1 parent 82f962d commit 1ad9a10

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

.travis.yml

+9
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,12 @@ script:
6767
- cmake .. -Dnlohmann_json_DIR=.. ${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
6868
- ctest -C Release -V -j
6969
- cd ..
70+
71+
# Remove previous build and tests
72+
- rm -r build
73+
74+
# Compile and execute with Hunter package manager instead of using local json.hpp
75+
- mkdir -p build && cd build
76+
- cmake .. -DHUNTER_ENABLED=ON ${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
77+
- ctest -C Release -V -j
78+
- cd ..

CMakeLists.txt

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Add Hunter support (Disabled by default)
2+
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
3+
if(HUNTER_ENABLED)
4+
include("cmake/HunterGate.cmake")
5+
HunterGate(
6+
URL "https://github.com/cpp-pm/hunter/archive/v0.23.262.tar.gz"
7+
SHA1 "eb51e633e08cdbe2153caf255e9c23968fecb29d"
8+
)
9+
endif()
10+
111
project(nlohmann_json_schema_validator
212
LANGUAGES CXX)
313

@@ -8,13 +18,8 @@ cmake_minimum_required(VERSION 3.2)
818
option(BUILD_TESTS "Build tests" ON)
919
option(BUILD_EXAMPLES "Build examples" ON)
1020

11-
option(HUNTER_ENABLED "Enable Hunter package manager support" OFF)
21+
# Add nlohmann_json::nlohmann_json using Hunter package manager
1222
if(HUNTER_ENABLED)
13-
include(cmake/HunterGate.cmake)
14-
HunterGate(URL https://github.com/cpp-pm/hunter/archive/v0.23.253.tar.gz
15-
SHA1 88ea6d37c897a81a080eb9ae0f69d7807bbb3c73)
16-
17-
# Add nlohmann_json::nlohmann_json (if HUNTER_ENABLED=ON, otherwise command is ignored)
1823
hunter_add_package(nlohmann_json)
1924
endif()
2025

0 commit comments

Comments
 (0)