From 865d16c9043107c5c4586df807b4e6af44dfabce Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 18 Jun 2015 13:08:03 +0200
Subject: [PATCH] Improved cppcheck on travis

Now in the cppcheck plumed is not built or tested.
Only cppcheck is performed
---
 .travis.yml | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b96e872d6..8c58ea7e8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,11 +16,10 @@ env:
   - PLUMED_CC=gcc   PLUMED_CXX=g++     PLUMED_CXXFLAGS=-O3 LAPACK=yes
   - PLUMED_CC=mpicc PLUMED_CXX=mpic++  PLUMED_CXXFLAGS=-O3 LAPACK=yes
 # cppcheck
-# in principle we should make only "cppcheck" here
-  - PLUMED_CC=gcc   PLUMED_CXX=g++   CPPCHECK=yes
+  - CPPCHECK=yes
 matrix:
   allow_failures:
-    - env: PLUMED_CC=gcc   PLUMED_CXX=g++   CPPCHECK=yes
+    - env: CPPCHECK=yes
 # Possible additional variables:
 #   VALGRIND=yes to make valgrind tests, only when log contains string [valgrind]
 install:
@@ -62,17 +61,27 @@ install:
 script:
 # we set all the optional modules on
   - touch src/crystallization.on src/manyrestraints.on
+
+# BUILD:
+# this is done only if PLUMED_CXX is defined
 # we have to pass the full path since on travis machines sudo does not have compilers in the path
-  - ./configure CXX=$(which $PLUMED_CXX) CC=$(which $PLUMED_CC) CXXFLAGS="$PLUMED_CXXFLAGS" LDFLAGS="$PLUMED_LDFLAGS" CPPFLAGS="$PLUMED_CPPFLAGS" $ENALMOST $CONFIG_FLAGS
-  - make -j 2
+  - if test "$PLUMED_CXX" ; then ./configure CXX=$(which $PLUMED_CXX) CC=$(which $PLUMED_CC) CXXFLAGS="$PLUMED_CXXFLAGS" LDFLAGS="$PLUMED_LDFLAGS" CPPFLAGS="$PLUMED_CPPFLAGS" $ENALMOST $CONFIG_FLAGS ; fi
+  - if test "$PLUMED_CXX" ; then make -j 2 ; fi
 # we install plumed so that it is in the path
-  - make install prefix="$HOME/opt"
-# run static analyzer
+  - if test "$PLUMED_CXX" ; then make install prefix="$HOME/opt" ; fi
+
+# TEST:
   - if test "$VALGRIND" == yes ; then OPT=valgrind ; else OPT="" ; fi
-  - make -C regtest $OPT
+  - if test "$PLUMED_CXX" ; then make -C regtest $OPT ; fi
   - if test "$MAKEDOC" == yes ; then make -C regtest copytodoc ; fi
   - if test "$MAKEDOC" == yes ; then make doc >/dev/null ; fi
-  - make -C regtest checkfail
+  - if test "$MAKEDOC" == yes ; then make -C regtest checkfail ; fi
+
+# CPPCHECK:
+# this is required so as to have all the include files inplace:
+# notice that this is done automatically in build
+  - if test "$CPPCHECK" == yes ; then make -C src/lib/ dirslinks ; fi
+# then we do cppcheck
   - if test "$CPPCHECK" == yes ; then make cppcheck ; fi
 after_success:
   - if test "$MAKEDOC" == yes ; then ./.travis.pushdoc
-- 
GitLab