Refactor source files into separate libraries

This gives me more control over what gets linked to what. It also solves
some linking issues.

Change-Id: Ifc6d5c8c7dd0931ba72b498ad0be592940e5fc59
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2abb379..1dd95a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,21 @@
 # we don't need filename tracking, and we prefer to use header-only Boost
 add_definitions(-DBOOST_SPIRIT_X3_NO_FILESYSTEM)
 
+add_library(path STATIC
+    src/ast_path.cpp
+    )
+target_link_libraries(path Boost::boost)
+
+add_library(ast_values STATIC
+    src/ast_values.cpp
+    )
+target_link_libraries(ast_values Boost::boost)
+
+add_library(utils STATIC
+    src/utils.cpp
+    )
+target_link_libraries(utils path Boost::boost)
+
 add_library(schemas STATIC
     src/static_schema.cpp
     src/schema.cpp
@@ -79,7 +94,7 @@
     src/sysrepo_access.cpp
     )
 
-target_link_libraries(sysrepoaccess datastoreaccess ${SYSREPO_LIBRARIES})
+target_link_libraries(sysrepoaccess datastoreaccess ast_values ${SYSREPO_LIBRARIES})
 link_directories(${SYSREPO_LIBRARY_DIRS})
 target_include_directories(sysrepoaccess SYSTEM PRIVATE ${SYSREPO_INCLUDE_DIRS})
 
@@ -88,7 +103,7 @@
     src/netconf_access.cpp
     )
 
-target_link_libraries(netconfaccess datastoreaccess ${LIBNETCONF2_LIBRARIES})
+target_link_libraries(netconfaccess datastoreaccess ast_values ${LIBNETCONF2_LIBRARIES})
 link_directories(${LIBNETCONF2_LIBRARY_DIRS})
 target_include_directories(netconfaccess SYSTEM PRIVATE ${LIBNETCONF2_INCLUDE_DIRS})
 
@@ -103,13 +118,11 @@
 add_library(parser STATIC
     src/parser.cpp
     src/ast_commands.cpp
-    src/ast_path.cpp
-    src/utils.cpp
     src/parser_context.cpp
     src/interpreter.cpp
     src/ast_handlers.cpp
     )
-target_link_libraries(parser schemas)
+target_link_libraries(parser schemas utils ast_values)
 
 
 add_library(sysreposubscription STATIC
@@ -262,6 +275,7 @@
     cli_test(list_manipulation)
     cli_test(parser_methods)
     cli_test(path_utils)
+    target_link_libraries(test_path_utils path)
 
     setup_datastore_tests()
     datastore_test(setting_values ${CMAKE_CURRENT_SOURCE_DIR}/example-schema.yang)