]> Creatis software - cpPlugins.git/blobdiff - third_party_installers/cpPlugins_Install_ITK.sh
...
[cpPlugins.git] / third_party_installers / cpPlugins_Install_ITK.sh
index 8af7e094aaa2d52e2cf93cf0e0584d3a43ed63a8..baf70ebb3239aafeb0c28f02f3ba9df68f8acb86 100755 (executable)
@@ -5,13 +5,20 @@ number_of_processes="-j4"
 comp_type=Debug
 
 ## Locate cmake executable
-cmake_exec="/usr/bin/cmake"
-if [ ! -x $cmake_exec ]; then
-    cmake_exec="/usr/local/bin/cmake"
-fi
-if [ ! -x $cmake_exec ]; then
-    cmake_exec="${HOME}/local/bin/cmake"
-fi
+cmake_locations=("/usr/bin" "/usr/local/bin" "${HOME}/local/bin")
+cmake_exec=""
+cmake_ver=""
+for loc in ${cmake_locations[@]}; do
+    cmake_file="$loc/cmake"
+    if [ -x $cmake_file ]; then
+        str=`$cmake_file --version | grep version`
+        version=${str:14}
+        if [ "$cmake_ver" \< "$version" ]; then
+            cmake_ver=$version
+            cmake_exec=$cmake_file
+        fi
+    fi
+done
 if [ ! -x $cmake_exec ]; then
     echo "$0: modify this script to put the correct location of cmake."
     exit 1