From 589a342e89a8abf77afa6cc28400725baebdb58a Mon Sep 17 00:00:00 2001
From: henry <Henry Weller h.weller@opencfd.co.uk>
Date: Thu, 16 Jul 2009 12:30:54 +0100
Subject: [PATCH] Added -qmake option to specify the location of qmake which
 defaults to the system one. The Qt version is now checked for >= 4.3.

---
 bin/buildParaView                |  7 +++++--
 bin/tools/buildParaViewFunctions | 25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/bin/buildParaView b/bin/buildParaView
index e7c6c6f9b06..622169e012f 100755
--- a/bin/buildParaView
+++ b/bin/buildParaView
@@ -58,8 +58,6 @@ withQTSUPPORT=true
 
 # Set the path to the Qt-4.3.? qmake if the system Qt is other than this version
 QMAKE_PATH=""
-#QMAKE_PATH=/usr/local/Trolltech/Qt-4.3.5/bin/qmake
-#QMAKE_PATH=$WM_THIRD_PARTY_DIR/qt-x11-opensource-src-4.3.5/platforms/linux64GccDPOpt/bin/qmake
 
 #
 # No further editing below this line
@@ -184,6 +182,11 @@ do
         withQTSUPPORT=true
         shift
         ;;
+    -qmake)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+        export QMAKE_PATH=$2
+        shift 2
+        ;;
     -verbose)
         withVERBOSE=true
         shift
diff --git a/bin/tools/buildParaViewFunctions b/bin/tools/buildParaViewFunctions
index f0873998af6..ff37e259b5f 100644
--- a/bin/tools/buildParaViewFunctions
+++ b/bin/tools/buildParaViewFunctions
@@ -171,10 +171,13 @@ addQtSupport()
 
     addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
 
+    qmakeExe=qmake
+
     if [ -n "$QMAKE_PATH" ]
     then
         if [ -x "$QMAKE_PATH" ]
         then
+            qmakeExe=$QMAKE_PATH
             addCMakeVariable QT_QMAKE_EXECUTABLE:FILEPATH=$QMAKE_PATH
         else
             echo
@@ -184,6 +187,28 @@ addQtSupport()
             echo
         fi
     fi
+
+    # Check qmake can be found
+    if [ `which $qmakeExe` ]
+    then
+        # Check the Qt version selected
+        QtVersion=`$qmakeExe -v | grep Using | sed "s/.* version \(.\..\).*/\1/"`
+        QtMajor=`echo $QtVersion | sed "s/\(.\)\../\1/"`
+        QtMinor=`echo $QtVersion | sed "s/.\.\(.\)/\1/"`
+
+        if [ $QtMajor -lt 4 -o $QtMinor -lt 3 ]
+        then
+            echo "*** Error: Qt version provided < 4.3"
+            echo "***     Please use the -qmake option to specify the location of a version of Qt >= 4.3 "
+            echo "***     e.g."
+            echo "***         -qmake /usr/local/Trolltech/Qt-4.3.5/bin/qmake"
+            echo "***         -qmake $WM_THIRD_PARTY_DIR/qt-x11-opensource-src-4.3.5/platforms/$WM_OPTIONS/bin/qmake"
+            exit 1
+        fi
+    else
+        echo "*** Error: cannot find qmake either at \$QMAKE_PATH or in current \$PATH"
+        exit 1
+    fi
 }
 
 
-- 
GitLab