Blame SOURCES/exiv2-fix-documentation-build.patch

240d3a
diff --git a/CMakeLists.txt b/CMakeLists.txt
240d3a
index 7034bb6..27e90de 100644
240d3a
--- a/CMakeLists.txt
240d3a
+++ b/CMakeLists.txt
240d3a
@@ -217,13 +217,16 @@ ADD_CUSTOM_TARGET(geotag-test COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin
240d3a
 # effectively does a make doc on the root directory
240d3a
 # has to run 'make config' and './configure'
240d3a
 # and copy bin/taglist to <exiv2dir>/bin/taglist for use by 'make doc'
240d3a
-IF( MINGW OR UNIX OR APPLE)
240d3a
-  ADD_CUSTOM_TARGET(doc
240d3a
-    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/doc"
240d3a
-    COMMAND chmod +x ./cmake_doc.sh
240d3a
-    COMMAND ./cmake_doc.sh "${CMAKE_BINARY_DIR}"
240d3a
-  )
240d3a
-ENDIF()
240d3a
+# IF( MINGW OR UNIX OR APPLE)
240d3a
+#   ADD_CUSTOM_TARGET(doc
240d3a
+#     WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/doc"
240d3a
+#     COMMAND chmod +x ./cmake_doc.sh
240d3a
+#     COMMAND ./cmake_doc.sh "${CMAKE_BINARY_DIR}"
240d3a
+#   )
240d3a
+# ENDIF()
240d3a
+
240d3a
+include(config/generateDoc.cmake REQUIRED)
240d3a
+generate_documentation("${PROJECT_SOURCE_DIR}/config/Doxyfile")
240d3a
240d3a
 # That's all Folks!
240d3a
 ##
240d3a
diff --git a/config/Doxyfile b/config/Doxyfile
240d3a
index db62e1d..5d357a7 100644
240d3a
--- a/config/Doxyfile
240d3a
+++ b/config/Doxyfile
240d3a
@@ -52,7 +52,7 @@ PROJECT_LOGO           =
240d3a
 # If a relative path is entered, it will be relative to the location
240d3a
 # where doxygen was started. If left blank the current directory will be used.
240d3a
240d3a
-OUTPUT_DIRECTORY       =
240d3a
+OUTPUT_DIRECTORY       = doc
240d3a
240d3a
 # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
240d3a
 # 4096 sub-directories (in 2 levels) under the output directory of each output
240d3a
@@ -1637,7 +1637,7 @@ TAGFILES               =
240d3a
 # When a file name is specified after GENERATE_TAGFILE, doxygen will create
240d3a
 # a tag file that is based on the input files it reads.
240d3a
240d3a
-GENERATE_TAGFILE       = html/exiv2.xml
240d3a
+GENERATE_TAGFILE       = doc/html/exiv2.xml
240d3a
240d3a
 # If the ALLEXTERNALS tag is set to YES all external classes will be listed
240d3a
 # in the class index. If set to NO only the inherited external classes
240d3a
diff --git a/config/generateDoc.cmake b/config/generateDoc.cmake
240d3a
new file mode 100644
240d3a
index 0000000..2b66078
240d3a
--- /dev/null
240d3a
+++ b/config/generateDoc.cmake
240d3a
@@ -0,0 +1,28 @@
240d3a
+# -helper macro to add a "doc" target with CMake build system.
240d3a
+# and configure doxy.config.in to doxy.config
240d3a
+#
240d3a
+# target "doc" allows building the documentation with doxygen/dot on WIN32, Linux and Mac
240d3a
+#
240d3a
+
240d3a
+find_package(Doxygen REQUIRED)
240d3a
+
240d3a
+macro(generate_documentation DOX_CONFIG_FILE)
240d3a
+    if(NOT EXISTS "${DOX_CONFIG_FILE}")
240d3a
+        message(FATAL_ERROR "Configuration file for doxygen not found")
240d3a
+    endif()
240d3a
+
240d3a
+    #Define variables
240d3a
+    set(INCDIR  "${PROJECT_SOURCE_DIR}/include/exiv2")
240d3a
+    set(SRCDIR  "${PROJECT_SOURCE_DIR}/src")
240d3a
+    set(ROOTDIR "${PROJECT_SOURCE_DIR}")
240d3a
+    #set(TESTSDIR "${PROJECT_SOURCE_DIR}/tests")
240d3a
+
240d3a
+    configure_file(${DOX_CONFIG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config @ONLY) #OUT-OF-PLACE LOCATION
240d3a
+    set(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
240d3a
+    add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
240d3a
+
240d3a
+    install(DIRECTORY "${PROJECT_BINARY_DIR}/doc/html/" DESTINATION "share/doc/html/lib${PROJECT_NAME}")
240d3a
+
240d3a
+    set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES doc)
240d3a
+endmacro()
240d3a
+