Implement YangSchema subclass

While we do not necessarily want to use `-isystem` for libyang, we
definitely need to use it for Boost itself. We are only using SPirit X3
directly, but that one still brings in a great deal of other supporting
libraries, including variant and a metaprogramming library.

In our CI environment, these are installed into the same prefix. Boost
itself is OK as we're including it via cmake imported target which uses
-isystem behind the scene. However, if we then add libyang via a regular
target_include_directories, the same path gets pushed into the include
paths, this time without -isystem, but rather as a regular -I. This in
turn starts affecting Boost, and we're screwed.

Fix this by ensuring that we consider libyang to be a system library,
too. We won't get annoyed by some extra warnings and therefore we won't
be able to improve that library as much as the CI would force us
otherwise :).

Change-Id: I7ec9b28501a46f8b2219f4920cbf5c1e4df59d7e
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5928c0e..4e09b90 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,14 @@
     )
 target_link_libraries(schemas PUBLIC Boost::boost)
 
+add_library(yangschema STATIC
+    src/yang_schema.cpp
+    )
+target_link_libraries(yangschema ${LIBYANG_LIBRARIES})
+# Ensure that this doesn't override Boost's -isystem -- see the log for details.
+target_include_directories(yangschema SYSTEM PRIVATE ${LIBYANG_INCLUDEDIR})
+link_directories(${LIBYANG_LIBRARY_DIRS})
+
 add_library(parser STATIC
     src/parser.cpp
     src/ast_commands.cpp
@@ -76,7 +84,7 @@
 add_executable(netconf-cli
     src/main.cpp
     )
-target_link_libraries(netconf-cli docopt parser)
+target_link_libraries(netconf-cli yangschema docopt parser)
 add_dependencies(netconf-cli target-NETCONF_CLI_VERSION)
 target_include_directories(netconf-cli PRIVATE ${PROJECT_BINARY_DIR})
 
@@ -118,6 +126,8 @@
     cli_test(ls)
     cli_test(presence_containers)
     cli_test(leaf_editing)
+    cli_test(yang)
+    target_link_libraries(test_yang yangschema)
 
 endif()