From efa245b4ee0bceb871dc3ef1d8c7a1d721acd6fe Mon Sep 17 00:00:00 2001
From: Arnaud Gelas <arnaud_gelas@hms.harvard.edu>
Date: Sun, 7 Aug 2011 12:10:28 -0400
Subject: [PATCH] Create add_doxygen_target macro to create a specific build target for doxygen

---
 Modules/FindDoxygen.cmake |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index e5428ae..cf6add2 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -132,8 +132,34 @@ endif()
 SET (DOXYGEN ${DOXYGEN_EXECUTABLE} )
 SET (DOT ${DOXYGEN_DOT_EXECUTABLE} )
 
+# ----------------------------------------------------------
+# add_doxygen_target( _targetname _configurationfile (ALL) )
+# _targetname : target name
+# _configurationfile : doxygen configuration file
+# (optional) ALL: if you want to add the target to ALL
+macro add_doxygen_target( _targetname _configurationfile )
+  set( _option ${ARGN} )
+  list( FIND _option ALL _all )
+
+  if( "${_all}" GREATER "-1" )
+    add_custom_target( $(_targetname} ALL
+      ${DOXYGEN_EXECUTABLE} ${_configurationfile}
+      DEPENDS ${_configurationfile}
+      COMMENT "Generating doxygen documentation"
+      )
+  else()
+    add_custom_target( $(_targetname}
+      ${DOXYGEN_EXECUTABLE} ${_configurationfile}
+      DEPENDS ${_configurationfile}
+      COMMENT "Generating doxygen documentation"
+  endif()
+endmacro()
+# ----------------------------------------------------------
+
 MARK_AS_ADVANCED(
   DOXYGEN_EXECUTABLE
   DOXYGEN_DOT_EXECUTABLE
   DOXYGEN_DOT_PATH
   )
+
+
-- 
1.7.4

