Index: gs2-extensions/xpdf-tools/trunk/src/move-cmake.sh
===================================================================
--- gs2-extensions/xpdf-tools/trunk/src/move-cmake.sh	(revision 32239)
+++ gs2-extensions/xpdf-tools/trunk/src/move-cmake.sh	(revision 32239)
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+
+print_usage() {
+    echo ""
+    echo "RUN AS: $0 <away|back>"
+    echo "  in 'back' mode, any existing cmake products will be in the bin subfolder"
+    echo "     ready for compiling"
+    echo "  in 'away' mode, cmake products are moved away into the separate devel folder"
+    echo "     ready for tarring up xpdf-tools"
+    echo ""
+}
+
+
+if [ -z $GEXT_XPDFTOOLS ] ; then
+    source setup.bash > /dev/null
+fi
+
+if [ -z $1 ]; then
+    print_usage
+fi
+
+# installed dir is extension's GSDLOS/bin subfolder, develdir is devel/GSDLOS subfolder
+installed=$GEXTXPDFTOOLS_INSTALLED
+develdir=$GEXT_XPDFTOOLS/devel/$GSDLOS
+
+
+if [ "x$1" == "xaway" ]; then
+    echo "away mode (moving out of the way)"
+    if [ -e "$installed/bin/cmake" ]; then
+	
+	echo "Moving cmake products in xpdftools' installed area into 'devel'"
+	
+	mkdir -p $develdir/bin
+	# 4 files in bin to move to devel/os/bin
+	mv $installed/bin/ccmake $installed/bin/cmake $develdir/bin
+	mv $installed/bin/cpack $installed/bin/ctest $develdir/bin
+	
+	# Could move the entire $installed/doc folder, as only cmake uses it
+	# and not xpdftools nor any other pkg in the xpdftools extension.
+	# If future-proofing, just move the cmake subfolder of doc
+	#mkdir -p $develdir/doc
+	#mv $installed/doc/cmake-3.11 $develdir/doc/.
+	if [ -d $develdir/doc ]; then
+	    rm -rf $develdir/doc
+	fi
+	# Now move the $installed/doc folder as it contains only CMake stuff
+	mv $installed/doc $develdir/.
+	
+	if [ -d $develdir/share ]; then
+	    rm -rf $develdir/share
+	fi
+	mkdir -p $develdir/share/aclocal
+	mv $installed/share/cmake-3.11 $develdir/share/.
+	mv $installed/share/aclocal/cmake.m4 $develdir/share/aclocal/.
+
+    else
+	echo "NOTE $installed/bin/cmake doesn't exist, so not moving anything"
+    fi
+# Do the reverse of the 'away' mode above for 'back' mode
+elif [ "x$1" == "xback" ]; then
+    echo "back mode (moving cmake back to where it was built)"
+    if [ -e "$develdir/bin/cmake" ]; then
+
+	echo "Moving cmake products from 'devel' back into xpdftools' installed area"
+
+	mv $develdir/bin/* $installed/bin/.
+
+	#mv $develdir/doc/* $installed/doc/.
+	mv $develdir/doc $installed/.
+
+	#if [ -e $develdir/share/aclocal/cmake.m4 ]; then
+	mv $develdir/share/cmake-3.11 $installed/share/.
+	mv $develdir/share/aclocal/cmake.m4 $installed/share/aclocal/.
+	#fi
+    else
+	echo "NOTE: $develdir/bin/cmake doesn't exist, so not moving anything"
+    fi
+fi
Index: gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/CMAKE.sh
===================================================================
--- gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/CMAKE.sh	(revision 32238)
+++ gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/CMAKE.sh	(revision 32239)
@@ -31,4 +31,16 @@
 fi
 
+# Check that CMake products weren't just moved out of the distribution area,
+# before recompiling all of CMake
+if [[ ! -e "$GEXTXPDFTOOLS_INSTALLED/bin/cmake" && -e "$GEXT_XPDFTOOLS/devel/$GSDLOS/bin/cmake" ]]; then
+    echo "**************************************"
+    echo "Moving intermediary CMake products back for development"
+    $GEXT_XPDFTOOLS/move-cmake.sh back
+    echo "**************************************"
+else
+    echo "@@@@ $GEXT_XPDFTOOLS/devel/$GSDLOS/bin/cmake does not exist"
+    echo "**************************************"
+fi
+
 # Only compile if necessary - we don't edit these source files:
 # Only compile up OUR cmake, and only if we haven't already got OUR cmake.
Index: gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh
===================================================================
--- gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh	(revision 32238)
+++ gs2-extensions/xpdf-tools/trunk/src/packages/CASCADE-MAKE/XPDFTOOLS.sh	(revision 32239)
@@ -123,2 +123,18 @@
 # If compilation was successful, then we don't need cmake binaries anymore when
 # packaging up xpdf-tools
+
+if [ -f "$GEXTXPDFTOOLS_INSTALLED/bin/pdftohtml" ]; then
+    echo "**************************************"
+    echo "Moving intermediary CMake products out of the distribution area"
+    $GEXT_XPDFTOOLS/move-cmake.sh away
+    echo "**************************************"
+fi
+
+#if [ -f "$installed/bin/pdftohtml" ]; then
+#    echo "XpdfTools compilation appears successful (pdftohtml's been generated)"
+#    echo "If ready to distribute, run:"
+#    echo "    move-cmake.sh away"
+#    echo "  to move intermediary products (CMake) out of the distribution area."
+#    echo "You can undo this when returning to re-compile by first running:"
+#    echo "    move-cmake.sh back"
+#fi
