From 79ae34c1312a80fd9fab1c487a4556ba7254019c Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Fri, 10 Jul 2015 12:24:21 -0400
Subject: [PATCH] move doxygen generation to a subdirectory

---
 build.sh                        |  2 +-
 indra/CMakeLists.txt            | 14 ++------------
 indra/doxygen/CMakeLists.txt    | 28 ++++++++++++++++++++++++++++
 indra/{ => doxygen}/Doxyfile.in |  6 +++---
 4 files changed, 34 insertions(+), 16 deletions(-)
 create mode 100755 indra/doxygen/CMakeLists.txt
 rename indra/{ => doxygen}/Doxyfile.in (99%)

diff --git a/build.sh b/build.sh
index ed75b20c59a..821d38a8443 100755
--- a/build.sh
+++ b/build.sh
@@ -408,7 +408,7 @@ then
         if [ -d "$build_dir/doxygen/html" ]
         then
             (cd "$build_dir/doxygen/html"; tar cjf "$build_dir/viewer-doxygen.tar.bz2" .)
-            upload_item docs viewer-doxygen.tar.bz2 binary/octet-stream
+            upload_item docs "$build_dir/viewer-doxygen.tar.bz2" binary/octet-stream
         fi
       *)
         echo "Skipping mapfile for $last_built_variant"
diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt
index 15b2329fc99..1e1d6dc585b 100755
--- a/indra/CMakeLists.txt
+++ b/indra/CMakeLists.txt
@@ -91,21 +91,11 @@ endif (LINUX)
 add_subdirectory(${VIEWER_PREFIX}newview)
 add_dependencies(viewer secondlife-bin)
 
+add_subdirectory(${VIEWER_PREFIX}doxygen EXCLUDE_FROM_ALL)
+
 if (LL_TESTS)
   # Define after the custom targets are created so
   # individual apps can add themselves as dependencies
   add_subdirectory(${INTEGRATION_TESTS_PREFIX}integration_tests)
 endif (LL_TESTS)
 
-# add a target to generate API documentation with Doxygen
-find_package(Doxygen)
-if(DOXYGEN_FOUND)
-    find_program(PERL perl) # I am not sure if this is really needed or not
-    GET_FILENAME_COMPONENT(DOXYGEN_TOP_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} PATH)
-    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
-    add_custom_target(doc
-                      ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
-                      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-                      COMMENT "Generating API documentation with Doxygen" VERBATIM
-                      )
-endif(DOXYGEN_FOUND)
diff --git a/indra/doxygen/CMakeLists.txt b/indra/doxygen/CMakeLists.txt
new file mode 100755
index 00000000000..84188bd32f9
--- /dev/null
+++ b/indra/doxygen/CMakeLists.txt
@@ -0,0 +1,28 @@
+# -*- cmake -*-
+
+# cmake_minimum_required should appear before any
+# other commands to guarantee full compatibility
+# with the version specified
+## prior to 2.8, the add_custom_target commands used in setting the version did not work correctly
+cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
+
+set(ROOT_PROJECT_NAME "SecondLife" CACHE STRING
+    "The root project/makefile/solution name. Defaults to SecondLife.")
+project(${ROOT_PROJECT_NAME})
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
+
+include(Variables)
+
+# add a target to generate API documentation with Doxygen
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+    GET_FILENAME_COMPONENT(DOXYGEN_TOP_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/.. PATH)
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
+    add_custom_target(doc
+                      ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+                      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/..
+                      COMMENT "Generating API documentation with Doxygen" VERBATIM
+                      )
+endif(DOXYGEN_FOUND)
+
diff --git a/indra/Doxyfile.in b/indra/doxygen/Doxyfile.in
similarity index 99%
rename from indra/Doxyfile.in
rename to indra/doxygen/Doxyfile.in
index db31000b2d0..5c600debdfe 100644
--- a/indra/Doxyfile.in
+++ b/indra/doxygen/Doxyfile.in
@@ -38,7 +38,7 @@ PROJECT_NUMBER         = @VIEWER_SHORT_VERSION@.@VIEWER_VERSION_REVISION@
 # If a relative path is entered, it will be relative to the location
 # where doxygen was started. If left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@/doxygen
+OUTPUT_DIRECTORY       = @CMAKE_CURRENT_BINARY_DIR@
 
 # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
 # 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -634,7 +634,7 @@ EXCLUDE_SYMBOLS        =
 # directories that contain example code fragments that are included (see
 # the \include command).
 
-EXAMPLE_PATH           = @CMAKE_CURRENT_SOURCE_DIR@/../doc
+EXAMPLE_PATH           = @CMAKE_CURRENT_SOURCE_DIR@/../../doc
 
 # If the value of the EXAMPLE_PATH tag contains directories, you can use the
 # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
@@ -1360,7 +1360,7 @@ EXTERNAL_GROUPS        = YES
 # The PERL_PATH should be the absolute path and name of the perl script
 # interpreter (i.e. the result of `which perl').
 
-PERL_PATH              = @PERL@
+#PERL_PATH              = @PERL@
 
 #---------------------------------------------------------------------------
 # Configuration options related to the dot tool
-- 
GitLab