Update CMake build to include external_schema example, and add usage info to external_schema.cpp.

This commit is contained in:
Tristan Penman 2014-06-15 15:24:26 +10:00
parent 89b58d84c8
commit 280250dbc8
3 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
build
bin
xcode/valijson.xcodeproj/project.xcworkspace
xcode/valijson.xcodeproj/project.xcworkspace/xcuserdata

View File

@ -20,6 +20,11 @@ add_subdirectory(thirdparty/gtest-1.7.0)
# Include path
include_directories(include thirdparty/gtest-1.7.0/include thirdparty/jsoncpp-0.5.0/include thirdparty/rapidjson-0.1/include)
# External schema validation example
add_executable(external_schema
examples/external_schema.cpp
)
# Unit tests executable
add_executable(test_suite
tests/test_adapter_comparison.cpp
@ -35,3 +40,5 @@ add_executable(test_suite
set(TEST_LIBS gtest gtest_main jsoncpp)
target_link_libraries(test_suite ${TEST_LIBS} ${Boost_LIBRARIES})
target_link_libraries(external_schema ${Boost_LIBRARIES})

View File

@ -29,6 +29,11 @@ using valijson::adapters::RapidJsonAdapter;
int main(int argc, char *argv[])
{
if (argc != 3) {
cerr << "Usage: " << argv[0] << " <schema document> <test/target document>" << endl;
return 1;
}
// Load the document containing the schema
rapidjson::Document schemaDocument;
if (!valijson::utils::loadDocument(argv[1], schemaDocument)) {
@ -73,4 +78,4 @@ int main(int argc, char *argv[])
}
return 0;
}
}