-cmake_exec="/usr/bin/qmake"
-if [ ! -x $cmake_exec ]; then
- cmake_exec="/usr/local/bin/qmake"
-fi
-if [ ! -x $cmake_exec ]; then
- cmake_exec="${HOME}/local/bin/qmake"
-fi
-if [ ! -x $cmake_exec ]; then
+qmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+qmake_exec=""
+for loc in ${qmake_locations[@]}; do
+ qmake_file="$loc/qmake"
+ if [ -x $qmake_file ]; then
+ str=`$qmake_file --version | grep Using\ Qt\ version`
+ version=`expr substr "$str" 18 3`
+ if [ "$version" == "4.8" ]; then
+ qmake_exec=$qmake_file
+ fi
+ fi
+done
+if [ ! -x $qmake_exec ]; then