diff --git a/build.sh b/build.sh
index ed75b20c59ab11eb19fb860d537c6c7da3494a33..821d38a844353e7adae9550a2e8c1445d6d3ae72 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 15b2329fc99d648931896f667ab622c9af409b48..1e1d6dc585bf6bab27402b8abdea4d27d1502075 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 0000000000000000000000000000000000000000..84188bd32f9592762a34fc9d9ebc23006b33eff3
--- /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 db31000b2d0ff04d8c4bc0f3e5e430562f9ab72d..5c600debdfe63eb6e50baab56f1919ab389d784a 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