From 493d4b01aca9a332bafb93cd6c6da0c58ad2c67a Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 1 Feb 2017 17:41:48 +0000 Subject: [PATCH] ENH: provide -link option for makeCmake - this creates a cmake-system link to the given cmake version, which is a simple means of providing an updated cmake version for the OpenFOAM build without actually needing to edit the etc/config.sh/paraview file --- makeCmake | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/makeCmake b/makeCmake index 6f566b9..5dce1b5 100755 --- a/makeCmake +++ b/makeCmake @@ -26,7 +26,10 @@ # makeCmake # # Description -# Build script for cmake +# Build script for cmake. +# +# The '-link' option can be used to create a 'cmake-system' pointing +# to this version. # # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE @@ -50,6 +53,7 @@ usage() { usage: ${0##*/} [OPTION] cmake-VERSION options: -gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX + -link Create additional symlink as 'cmake-system' -help * build cmake @@ -63,6 +67,7 @@ USAGE [ -n "$WM_CC" ] && export CC="$WM_CC" [ -n "$WM_CXX" ] && export CXX="$WM_CXX" +unset optLink # Parse options while [ "$#" -gt 0 ] do @@ -74,6 +79,9 @@ do export CC=gcc # use gcc/g++ export CXX=g++ ;; + -link) + optLink=true + ;; cmake-[1-9]*) cmakePACKAGE="${1%%/}" ;; @@ -86,6 +94,11 @@ done [ -n "$cmakePACKAGE" ] || die "The cmake-VERSION was not specified" +if _foamIsSystem "$cmakePACKAGE" +then + unset optLink # basic sanity - cannot +fi + #------------------------------------------------------------------------------ # # Build CMAKE @@ -121,4 +134,19 @@ else } fi +if [ "$optLink" = true -a -x "$CMAKE_ARCH_PATH/bin/cmake" ] +then +( + cd ${CMAKE_ARCH_PATH%/*} || exit 1 + if [ -L cmake-system ] + then + rm cmake-system + elif [ -d cmake-system ] + then + exit 2 + fi + ln -svf $cmakePACKAGE cmake-system +) +fi + #------------------------------------------------------------------------------