build REFACTOR doc module improvements

Also, Doxyfile.in is now generic for any
project.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c9f5ad..42a9ebd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,7 @@
 include(UseCompat)
 include(ABICheck)
 include(SourceFormat)
-include(Doc)
+include(GenDoc)
 
 # set default build type if not specified by user
 if(NOT CMAKE_BUILD_TYPE)
@@ -169,6 +169,18 @@
     src/version.h
     src/config.h)
 
+# files to generate doxgen from
+set(doxy_files
+    doc/build.dox
+    doc/transition.dox
+    ${headers}
+    ${PROJECT_BINARY_DIR}/src/version.h
+    ${type_plugins})
+
+# project (doxygen) logo
+set(project_logo
+    doc/logo.png)
+
 # source files to be covered by the 'format' target
 set(format_sources
     compat/*
@@ -181,7 +193,7 @@
 #
 
 if("${BUILD_TYPE_UPPER}" STREQUAL "DOCONLY")
-    libyang_doc()
+    gen_doc("${doxy_files}" ${LIBYANG_VERSION} ${LIBYANG_DESCRIPTION} ${project_logo})
     return()
 endif()
 
@@ -358,7 +370,7 @@
 add_subdirectory(tools)
 
 # generate doxygen documentation for libyang API
-libyang_doc()
+gen_doc("${doxy_files}" ${LIBYANG_VERSION} ${LIBYANG_DESCRIPTION} ${project_logo})
 
 # generate API/ABI report
 if ("${BUILD_TYPE_UPPER}" STREQUAL "ABICHECK")
diff --git a/CMakeModules/Doc.cmake b/CMakeModules/GenDoc.cmake
similarity index 61%
rename from CMakeModules/Doc.cmake
rename to CMakeModules/GenDoc.cmake
index 1800072..ee879d0 100644
--- a/CMakeModules/Doc.cmake
+++ b/CMakeModules/GenDoc.cmake
@@ -1,5 +1,5 @@
 # Prepare building doxygen documentation
-macro(LIBYANG_DOC)
+macro(GEN_DOC INPUT_FILES PROJECT_VERSION PROJECT_DESCRIPTION DOC_LOGO)
     find_package(Doxygen)
     if(DOXYGEN_FOUND)
         find_program(DOT_PATH dot PATH_SUFFIXES graphviz2.38/bin graphviz/bin)
@@ -9,10 +9,20 @@
             set(HAVE_DOT "NO")
             message(AUTHOR_WARNING "Doxygen: to generate UML diagrams please install graphviz")
         endif()
+
+        # target doc
         add_custom_target(doc
                 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
                 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-        string(REPLACE ";" " " DOXY_HEADERS "${headers};${PROJECT_BINARY_DIR}/src/version.h;${type_plugins}")
+
+        # generate list with spaces as separators
+        string(REPLACE ";" " " DOXY_INPUT "${INPUT_FILES}")
+
+        # make other arguments into variables
+        set(PROJECT_VERSION ${PROJECT_VERSION})
+        set(PROJECT_DESCRIPTION ${PROJECT_DESCRIPTION})
+        set(DOC_LOGO ${DOC_LOGO})
+
         configure_file(Doxyfile.in Doxyfile)
     endif()
 endmacro()
diff --git a/Doxyfile.in b/Doxyfile.in
index 848c353..0274677 100644
--- a/Doxyfile.in
+++ b/Doxyfile.in
@@ -32,26 +32,26 @@
 # title of most generated pages and in a few other places.
 # The default value is: My Project.
 
-PROJECT_NAME           = libyang
+PROJECT_NAME           = @PROJECT_NAME@
 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = @LIBYANG_VERSION@
+PROJECT_NUMBER         = @PROJECT_VERSION@
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
 # quick idea about the purpose of the project. Keep the description short.
 
-PROJECT_BRIEF          = "YANG data modeling language library"
+PROJECT_BRIEF          = @PROJECT_DESCRIPTION@
 
 # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
 # in the documentation. The maximum height of the logo should not exceed 55
 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
 # the logo to the output directory.
 
-PROJECT_LOGO           = ./doc/logo.png
+PROJECT_LOGO           = @DOC_LOGO@
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
 # into which the generated documentation will be written. If a relative path is
@@ -781,7 +781,7 @@
 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
 # Note: If this tag is empty the current directory is searched.
 
-INPUT                  = doc/build.dox doc/transition.dox @DOXY_HEADERS@
+INPUT                  = @DOXY_INPUT@
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses