build FEATURE new build type to generate only docs without building sources

Adds new DocOnly build type for cmake to allow generate makefile only to
build doxygen documentation. This allows to create docs even in
environment with missing build dependencies (pcre2).

The change require some refactoring of CMakeList.txt to have all the
variables available before processing cmake build types and preparing
specific make targets.
diff --git a/CMakeModules/Doc.cmake b/CMakeModules/Doc.cmake
new file mode 100644
index 0000000..9301d43
--- /dev/null
+++ b/CMakeModules/Doc.cmake
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+# Prepare building doxygen documentation
+macro(LIBYANG_DOC)
+    find_package(Doxygen)
+    if(DOXYGEN_FOUND)
+        find_program(DOT_PATH dot PATH_SUFFIXES graphviz2.38/bin graphviz/bin)
+        if(DOT_PATH)
+            set(HAVE_DOT "YES")
+        else()
+            set(HAVE_DOT "NO")
+            message(AUTHOR_WARNING "Doxygen: to generate UML diagrams please install graphviz")
+        endif()
+        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")
+        configure_file(Doxyfile.in Doxyfile)
+    endif()
+endmacro()