diff --git a/Geo/CellComplex.cpp b/Geo/CellComplex.cpp
index 2eb31a86ac99368be821596280cc6da95fd2b598..3a232c26c74b7eb994e39913839a772145d40103 100644
--- a/Geo/CellComplex.cpp
+++ b/Geo/CellComplex.cpp
@@ -102,7 +102,7 @@ CellComplex::CellComplex( std::vector<GEntity*> domain, std::vector<GEntity*> su
   int tag = 1;
   for(int i = 0; i < 4; i++){
     for(citer cit = firstCell(i); cit != lastCell(i); cit++){
-      Cell* cell = *cit;
+      //Cell* cell = *cit;
       //cell->setTag(tag);
       tag++;
     }
diff --git a/Geo/CellComplex.h b/Geo/CellComplex.h
index 9507d9ce3b567e3c015681c984b80caa85eb7dc7..2e34b8b2bfba200ee57db0a17d6e14c212481633 100644
--- a/Geo/CellComplex.h
+++ b/Geo/CellComplex.h
@@ -447,7 +447,9 @@ class CQuadrangle : public Cell, public MQuadrangle
      MQuadrangle::getEdgeVertices(num, v);
    }
    
-   void printCell() const { printf("Cell dimension: %d, Vertices: %d %d %d, in subdomain: %d\n", getDim(), _v[0]->getNum(), _v[1]->getNum(), _v[2]->getNum(), _v[3]->getNum(), _inSubdomain); }
+   void printCell() const { printf("Cell dimension: %d, Vertices: %d %d %d %d, in subdomain: %d\n", 
+                                    getDim(), _v[0]->getNum(), _v[1]->getNum(), _v[2]->getNum(), 
+                                    _v[3]->getNum(), _inSubdomain); }
 };
 
 
diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index b19caf2898cd4d417288dc2a1610e58f18c9278c..8cb5618185b88ad8ec46be7e52148575bc2d5f2f 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -596,7 +596,7 @@ int GModel::writeMSH(const std::string &name, double version, bool binary,
     if(n) elements[(*it)->quadrangles[0]->getTypeForMSH()] += n;
     n = p * (*it)->polygons.size();
     if(n) elements[(*it)->polygons[0]->getTypeForMSH()] += n;
-    for(int i = 0; i < (*it)->polygons.size(); i++)
+    for(unsigned int i = 0; i < (*it)->polygons.size(); i++)
       if((*it)->polygons[i]->ownsParent()) {
         parents[0][(*it)->polygons[i]->getParent()] = (*it);
         numParents += p;
@@ -614,7 +614,7 @@ int GModel::writeMSH(const std::string &name, double version, bool binary,
     if(n) elements[(*it)->pyramids[0]->getTypeForMSH()] += n;
     n = p * (*it)->polyhedra.size();
     if(n) elements[(*it)->polyhedra[0]->getTypeForMSH()] += n;
-    for(int i = 0; i < (*it)->polyhedra.size(); i++)
+    for(unsigned int i = 0; i < (*it)->polyhedra.size(); i++)
       if((*it)->polyhedra[i]->ownsParent()) {
         parents[1][(*it)->polyhedra[i]->getParent()] = (*it);
         numParents += p;
diff --git a/Numeric/fullMatrix.h b/Numeric/fullMatrix.h
index 982a86dc17373729d29adfbe5d5ad82c1ebd33b7..dcc2384ead3c7ec3d512453eed4d2535ed713195 100644
--- a/Numeric/fullMatrix.h
+++ b/Numeric/fullMatrix.h
@@ -3,8 +3,8 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
 
-#ifndef _GMSH_MATRIX_H_
-#define _GMSH_MATRIX_H_
+#ifndef _FULL_MATRIX_H_
+#define _FULL_MATRIX_H_
 
 #include <math.h>
 #include <stdio.h>
diff --git a/Post/PViewDataRemote.h b/Post/PViewDataRemote.h
index 5518ac48f7086cc84d253487b4f88a52e14963d0..a2014baa02b0ed69878db448a21ead2682cb842b 100644
--- a/Post/PViewDataRemote.h
+++ b/Post/PViewDataRemote.h
@@ -34,7 +34,7 @@ class PViewDataRemote : public PViewData {
   SBoundingBox3d getBoundingBox(int step=-1){ return _bbox; }
   double getTime(int step)
   {
-    if(step >= 0 && step < _time.size()) return _time[step];
+    if(step >= 0 && step < (int)_time.size()) return _time[step];
     return 0.; 
   }
   int getNumElements(int step=-1, int ent=-1)
@@ -48,7 +48,7 @@ class PViewDataRemote : public PViewData {
   void setBoundingBox(SBoundingBox3d bbox){ _bbox = bbox; }
   void setTime(int step, double time)
   {
-    if(step >= _time.size()) _time.resize(step + 1);
+    if(step >= (int)_time.size()) _time.resize(step + 1);
     _time[step] = time;
   }
 };
diff --git a/Solver/elasticityTerm.cpp b/Solver/elasticityTerm.cpp
index 44e7293cee7f33f70692ccd8076cdce7b03fa903..1d10aea44c3a704955f371752bb7caacdcae7d09 100644
--- a/Solver/elasticityTerm.cpp
+++ b/Solver/elasticityTerm.cpp
@@ -95,9 +95,9 @@ void elasticityTerm::elementVector(MElement *e, fullVector<double> &m) const
     const double detJ = e->getJacobian(u, v, w, jac);
     e->getShapeFunctions(u, v, w, ff);
     for (int j = 0; j < nbNodes; j++){
-      m(j)           += _volumeForce.x() *ff[j] * weight * detJ *.5;
-      m(j+nbNodes)   += _volumeForce.y() *ff[j] * weight * detJ *.5;
-      m(j+2*nbNodes) += _volumeForce.z() *ff[j] * weight * detJ *.5;
+      m(j) += _volumeForce.x() *ff[j] * weight * detJ *.5;
+      m(j + nbNodes) += _volumeForce.y() *ff[j] * weight * detJ *.5;
+      m(j + 2 * nbNodes) += _volumeForce.z() *ff[j] * weight * detJ *.5;
     }
   } 
 }
diff --git a/Solver/elasticityTerm.h b/Solver/elasticityTerm.h
index 656aa802170627989a27ab911ad7f25a8a6d7d51..a08b0cbf463727bf8d1359e80260aead91dce494 100644
--- a/Solver/elasticityTerm.h
+++ b/Solver/elasticityTerm.h
@@ -33,7 +33,7 @@ class elasticityTerm : public femTerm<double, double> {
   public:
   elasticityTerm(GModel *gm, double E, double nu, int iField) : 
     femTerm<double, double>(gm), _E(E), _nu(nu), _iField(iField) {}
-  void setVector(const SVector3 &f) {_volumeForce = f;}
+  void setVector(const SVector3 &f) { _volumeForce = f; }
   void elementMatrix(MElement *e, fullMatrix<double> &m) const;
   void elementVector(MElement *e, fullVector<double> &m) const;
 };
diff --git a/contrib/ANN/CMakeLists.txt b/contrib/ANN/CMakeLists.txt
index cc237338b92f184205a8f8d22284b312f56979df..2fe5a811cb96311a98bb31526b281d86f5b8ba61 100644
--- a/contrib/ANN/CMakeLists.txt
+++ b/contrib/ANN/CMakeLists.txt
@@ -20,4 +20,5 @@ set(SRC
   src/perf.cpp
 )
 
-append_gmsh_src(contrib/ANN "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/ANN *.h)
+append_gmsh_src(contrib/ANN "${SRC};${HDR}")
diff --git a/contrib/Chaco/CMakeLists.txt b/contrib/Chaco/CMakeLists.txt
index 8e616be818c482b9940157a1d43f26a8d7c6ac6f..5ea1e172d9c7928ebe2fd47235d696961ff22703 100644
--- a/contrib/Chaco/CMakeLists.txt
+++ b/contrib/Chaco/CMakeLists.txt
@@ -88,4 +88,5 @@ set(SRC
   util/vecscale.c 
 )
 
-append_gmsh_src(contrib/Chaco "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/Chaco *.h)
+append_gmsh_src(contrib/Chaco "${SRC};${HDR}")
diff --git a/contrib/DiscreteIntegration/CMakeLists.txt b/contrib/DiscreteIntegration/CMakeLists.txt
index 0a93dd05eeecb06b590c13ba773faf1d06c2d050..a3589668ab182eefb0afff66c7f958ab0c9119e2 100644
--- a/contrib/DiscreteIntegration/CMakeLists.txt
+++ b/contrib/DiscreteIntegration/CMakeLists.txt
@@ -9,4 +9,5 @@ set(SRC
   recurCut.cpp
 )
 
-append_gmsh_src(contrib/DiscreteIntegration "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/DiscreteIntegration *.h)
+append_gmsh_src(contrib/DiscreteIntegration "${SRC};${HDR}")
diff --git a/contrib/Fl_Tree/CMakeLists.txt b/contrib/Fl_Tree/CMakeLists.txt
index 253dc069ebd6a8cb1a480455e16f6aaae0677e06..ba0727371c203dffb28a2b0acb89036a9a9095ec 100644
--- a/contrib/Fl_Tree/CMakeLists.txt
+++ b/contrib/Fl_Tree/CMakeLists.txt
@@ -10,4 +10,5 @@ set(SRC
   Fl_Tree_Prefs.cxx
 )
 
-append_gmsh_src(contrib/Fl_Tree "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/Fl_Tree *.H)
+append_gmsh_src(contrib/Fl_Tree "${SRC};${HDR}")
diff --git a/contrib/MathEx/CMakeLists.txt b/contrib/MathEx/CMakeLists.txt
index 94a6dbe5f80d13790a022807b7aed4625493352d..cd09ac3981001421f581a30939931465c5d153ea 100644
--- a/contrib/MathEx/CMakeLists.txt
+++ b/contrib/MathEx/CMakeLists.txt
@@ -7,4 +7,5 @@ set(SRC
   mathex.cpp
 )
 
-append_gmsh_src(contrib/MathEx "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/MathEx *.h)
+append_gmsh_src(contrib/MathEx "${SRC};${HDR}")
diff --git a/contrib/Metis/CMakeLists.txt b/contrib/Metis/CMakeLists.txt
index 6489bf939a42057a9a8cfa75552552ac0a32d009..514497a1f2dd1d8bde2130b66e9fb6ac384b1372 100644
--- a/contrib/Metis/CMakeLists.txt
+++ b/contrib/Metis/CMakeLists.txt
@@ -58,4 +58,5 @@ set(SRC
   stat.c
 )
 
-append_gmsh_src(contrib/Metis "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/Metis *.h)
+append_gmsh_src(contrib/Metis "${SRC};${HDR}")
diff --git a/contrib/NativeFileChooser/CMakeLists.txt b/contrib/NativeFileChooser/CMakeLists.txt
index 219dfe224e0b42def2cba75741452b9c74fe10b0..6c833c93827dfd1a3303e557361255bb9de7ce8f 100644
--- a/contrib/NativeFileChooser/CMakeLists.txt
+++ b/contrib/NativeFileChooser/CMakeLists.txt
@@ -7,4 +7,5 @@ set(SRC
   Fl_Native_File_Chooser.cxx
 )
 
-append_gmsh_src(contrib/NativeFileChooser "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/NativeFileChooser *.H)
+append_gmsh_src(contrib/NativeFileChooser "${SRC};${HDR}")
diff --git a/contrib/Netgen/CMakeLists.txt b/contrib/Netgen/CMakeLists.txt
index 5504aff2c65f6f3f7b53a39b1c7dceecb232a348..d2dff4cdb0304566517f5bde15d601013231e1d4 100644
--- a/contrib/Netgen/CMakeLists.txt
+++ b/contrib/Netgen/CMakeLists.txt
@@ -38,4 +38,5 @@ set(SRC
   ${opt}/bfgs.cpp ${opt}/linsearch.cpp ${opt}/linopt.cpp
 )
 
-append_gmsh_src(contrib/Netgen "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/Netgen *.h)
+append_gmsh_src(contrib/Netgen "${SRC};${HDR}")
diff --git a/contrib/Tetgen/CMakeLists.txt b/contrib/Tetgen/CMakeLists.txt
index e418dda62bd1cddebffc61b59f1dd29f3551fa0b..c870b7b60e94f642516a9fd285b225ad38da7ef0 100644
--- a/contrib/Tetgen/CMakeLists.txt
+++ b/contrib/Tetgen/CMakeLists.txt
@@ -8,4 +8,5 @@ set(SRC
   predicates.cxx
 )
 
-append_gmsh_src(contrib/Tetgen "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/Tetgen *.h)
+append_gmsh_src(contrib/Tetgen "${SRC};${HDR}")
diff --git a/contrib/TetgenNew/CMakeLists.txt b/contrib/TetgenNew/CMakeLists.txt
index 36c388b2df99aa5542ff9086ec595551dabd1f06..0fc18eb9b6f27674ab7a9292287f661a33d2eb46 100644
--- a/contrib/TetgenNew/CMakeLists.txt
+++ b/contrib/TetgenNew/CMakeLists.txt
@@ -19,4 +19,5 @@ set(SRC
   surface.cxx
 )
 
-append_gmsh_src(contrib/TetgenNew "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/TetgenNew *.h)
+append_gmsh_src(contrib/TetgenNew "${SRC};${HDR}")
diff --git a/contrib/kbipack/CMakeLists.txt b/contrib/kbipack/CMakeLists.txt
index f7a75b9fd08ca2d60371852b89ef611d013a531f..36e436e5c65a8034446bb6f928974e58b6831ed7 100644
--- a/contrib/kbipack/CMakeLists.txt
+++ b/contrib/kbipack/CMakeLists.txt
@@ -10,4 +10,5 @@ set(SRC
   gmp_blas.c
 )
 
-append_gmsh_src(contrib/kbipack "${SRC}")
+file(GLOB_RECURSE HDR RELATIVE ${CMAKE_SOURCE_DIR}/contrib/kbipack *.h)
+append_gmsh_src(contrib/kbipack "${SRC};${HDR}")