From 4293c8cc3e4cc47cb84e63dec957142875ec29b9 Mon Sep 17 00:00:00 2001 From: "Geoff R. McLane" Date: Wed, 29 Apr 2015 18:23:28 +0200 Subject: [PATCH] Add setting the CMAKE_BUILD_TYPE to build-me.sh. The default MUST set -DCMAKE_BUILD_TYPE=Release - without this addition the -DNDEBUG compiler flag is NOT set, leaving 'asserts' in the code. Asserts are good and necessary for a Debug version, for testing, but with their brutal abort on error should NOT really be in Release code IMHO. And after all this is ONLY in a 'sample' build-me.sh script. Users are free to use whatever options they desire in their own build of tidy, and frequently do. --- build/cmake/build-me.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/build/cmake/build-me.sh b/build/cmake/build-me.sh index 7e33e85..61bdbdd 100755 --- a/build/cmake/build-me.sh +++ b/build/cmake/build-me.sh @@ -30,28 +30,31 @@ if [ -f "$BLDLOG" ]; then rm -f $BLDLOG fi +BLDDBG=0 TMPOPTS="" ############################################## ### ***** NOTE THIS INSTALL LOCATION ***** ### ### Change to suit your taste, environment ### -############################################## -# TMPINST="$HOME/projects/install/tidy" -# TMPOPTS="-DCMAKE_INSTALL_PREFIX=$TMPINST" -############################################# -# To build SHARED library -TMPOPTS="$TMPOPTS -DBUILD_SHARED_LIB:BOOL=TRUE" TMPINST="/usr" TMPOPTS="$TMPOPTS -DCMAKE_INSTALL_PREFIX=$TMPINST" +############################################## +### Accept user argument for arg in $@; do case $arg in VERBOSE) TMPOPTS="$TMPOPTS -DCMAKE_VERBOSE_MAKEFILE=ON" ;; - DEBUG) TMPOPTS="$TMPOPTS -DCMAKE_BUILD_TYPE=Debug -DENABLE_DEBUG_SYMBOLS:BOOL=TRUE" ;; + DEBUG) BLDDBG=1 ;; SHARED) TMPOPTS="$TMPOPTS -DBUILD_SHARED_LIB:BOOL=TRUE" ;; *) TMPOPTS="$TMPOPTS $arg" ;; esac done +if [ "$BLDDBG" = "1" ]; then + TMPOPTS="$TMPOPTS -DCMAKE_BUILD_TYPE=Debug -DENABLE_DEBUG_SYMBOLS:BOOL=TRUE" +else + TMPOPTS="$TMPOPTS -DCMAKE_BUILD_TYPE=Release" +fi + echo "$BN: Will do: 'cmake $TMPSRC $TMPOPTS' to $BLDLOG" wait_for_input