File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,26 @@ if (NOT TARGET nlohmann_json_schema_validator::validator)
61
61
endif ()
62
62
endif ()
63
63
endif ()
64
+ # Fetch/Find Catch2
65
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
66
+ FetchContent_Declare(Catch2
67
+ GIT_REPOSITORY https://github.com/catchorg/Catch2
68
+ GIT_TAG v3.4.0
69
+ FIND_PACKAGE_ARGS CONFIG
70
+ )
71
+ list (APPEND fetch_packages Catch2)
72
+ else ()
73
+ # Try to get system installed version
74
+ find_package (Catch2 QUIET )
75
+ if (NOT Catch2_FOUND)
76
+ # If failed fetch the desired version
77
+ FetchContent_Declare(Catch2
78
+ GIT_REPOSITORY https://github.com/catchorg/Catch2
79
+ GIT_TAG v3.4.0
80
+ )
81
+ list (APPEND fetch_packages Catch2)
82
+ endif ()
83
+ endif ()
64
84
65
85
# Get all dependencies
66
86
FetchContent_MakeAvailable(${fetch_packages} )
@@ -70,6 +90,14 @@ FetchContent_MakeAvailable(${fetch_packages})
70
90
]==============================================================================================]
71
91
72
92
enable_testing ()
93
+ include (Catch)
94
+
95
+ add_executable (json-schema-test -suite)
96
+ set_target_properties (json-schema-test -suite PROPERTIES
97
+ OUTPUT_NAME test -suite
98
+ )
99
+ target_link_libraries (json-schema-test -suite PRIVATE Catch2::Catch2WithMain nlohmann_json_schema_validator::validator)
100
+ catch_discover_tests(json-schema-test -suite)
73
101
74
102
set (PIPE_IN_TEST_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR} /test -pipe-in.sh)
75
103
You can’t perform that action at this time.
0 commit comments