diff --git a/Plugin/ThinLayerFixMesh.cpp b/Plugin/ThinLayerFixMesh.cpp
index fc13bc63e5ad3da24bb79491d98f9f75d11219a4..7a8b786b481b0aa6541ce90045ed4aa8919feed3 100644
--- a/Plugin/ThinLayerFixMesh.cpp
+++ b/Plugin/ThinLayerFixMesh.cpp
@@ -9,10 +9,49 @@
 #include "GModel.h"
 #include "robustPredicates.h"
 #include "GRegion.h"
+#if defined(HAVE_MESH)
 #include "meshGFaceDelaunayInsertion.h"
+#endif
+
 //#include "meshGFace.h"
 
+extern "C"
+{
+  GMSH_Plugin *GMSH_RegisterThinLayerFixMeshPlugin()
+  {
+    return new GMSH_ThinLayerFixMeshPlugin();
+  }
+}
 
+StringXNumber ThingLayerFixMeshOptions_Number[] = {
+//  {GMSH_FULLRC, "Dimension", NULL, 1.},
+//  {GMSH_FULLRC, "PhysicalGroup", NULL, 1.},
+//  {GMSH_FULLRC, "OpenBoundaryPhysicalGroup", NULL, 0.},
+};
+
+
+
+//GMSH_ThinLayerFixMeshPlugin::GMSH_ThinLayerFixMeshPlugin(){}
+
+//GMSH_ThinLayerFixMeshPlugin::~GMSH_ThinLayerFixMeshPlugin(){}
+
+std::string GMSH_ThinLayerFixMeshPlugin::getHelp() const
+{
+  return "Fix the mesh in thin parts";
+}
+
+int GMSH_ThinLayerFixMeshPlugin::getNbOptions() const
+{
+  return sizeof(ThingLayerFixMeshOptions_Number) / sizeof(StringXNumber);
+}
+
+StringXNumber *GMSH_ThinLayerFixMeshPlugin::getOption(int iopt)
+{
+  return &ThingLayerFixMeshOptions_Number[iopt];
+}
+
+
+#if defined(HAVE_MESH)
 
 CorrespVerticesFixMesh::CorrespVerticesFixMesh(){
 //	std::cout<<"started init CorrespVerticesFixMesh"<<std::endl;
@@ -115,38 +154,7 @@ int CorrespVerticesFixMesh::getTagMaster(){
 	return tagMaster;
 }
 
-StringXNumber ThingLayerFixMeshOptions_Number[] = {
-//  {GMSH_FULLRC, "Dimension", NULL, 1.},
-//  {GMSH_FULLRC, "PhysicalGroup", NULL, 1.},
-//  {GMSH_FULLRC, "OpenBoundaryPhysicalGroup", NULL, 0.},
-};
-
-extern "C"
-{
-  GMSH_Plugin *GMSH_RegisterThinLayerFixMeshPlugin()
-  {
-    return new GMSH_ThinLayerFixMeshPlugin();
-  }
-}
-
-//GMSH_ThinLayerFixMeshPlugin::GMSH_ThinLayerFixMeshPlugin(){}
-
-//GMSH_ThinLayerFixMeshPlugin::~GMSH_ThinLayerFixMeshPlugin(){}
-
-std::string GMSH_ThinLayerFixMeshPlugin::getHelp() const
-{
-  return "Fix the mesh in thin parts";
-}
 
-int GMSH_ThinLayerFixMeshPlugin::getNbOptions() const
-{
-  return sizeof(ThingLayerFixMeshOptions_Number) / sizeof(StringXNumber);
-}
-
-StringXNumber *GMSH_ThinLayerFixMeshPlugin::getOption(int iopt)
-{
-  return &ThingLayerFixMeshOptions_Number[iopt];
-}
 
 PView *GMSH_ThinLayerFixMeshPlugin::execute(PView *view)
 {
@@ -1160,3 +1168,13 @@ std::map<MTetrahedron*,MTet4*> GMSH_ThinLayerFixMeshPlugin::TetToTet4;
 std::map<MVertex*,std::vector<CorrespVerticesFixMesh*> > GMSH_ThinLayerFixMeshPlugin::VertexToCorresp;
 std::vector<std::vector<CorrespVerticesFixMesh*> > GMSH_ThinLayerFixMeshPlugin::vecOfThinSheets;
 
+
+#else
+
+PView *GMSH_ThinLayerFixMeshPlugin::execute(PView *view)
+{
+  Msg::Error("Plugin(ThinLayerFixMesh requires mesh module");
+  return view;
+}
+
+#endif
\ No newline at end of file
diff --git a/Plugin/ThinLayerFixMesh.h b/Plugin/ThinLayerFixMesh.h
index ad412189247c0534e2d5bc7f62e3edcf17a35d74..083283736869a69e9d869d58ace2d8eb44bb0c40 100644
--- a/Plugin/ThinLayerFixMesh.h
+++ b/Plugin/ThinLayerFixMesh.h
@@ -11,13 +11,17 @@
 #include "Plugin.h"
 #include "MVertex.h"
 #include "MTriangle.h"
+#if defined(HAVE_MESH)
 #include "meshGRegionDelaunayInsertion.h"
+#endif
+
 
 extern "C"
 {
   GMSH_Plugin *GMSH_RegisterThinLayerFixMeshPlugin();
 }
 
+#if defined(HAVE_MESH)
 static int faces[4][3] = {{0,1,2}, {0,2,3}, {0,3,1}, {1,3,2}};
 
 struct faceXtetFM{
@@ -134,6 +138,7 @@ public:
 	bool getIsMaster();
 	int getTagMaster();
 };
+#endif
 
 class GMSH_ThinLayerFixMeshPlugin : public GMSH_PostPlugin
 {
@@ -150,6 +155,7 @@ public:
 	int getNbOptions() const;
 	StringXNumber* getOption(int iopt);
 	PView *execute(PView *);
+#if defined(HAVE_MESH)
 	static void perform();
 	static void checkOppositeTriangles();
 	static void fillvecOfThinSheets();
@@ -170,6 +176,7 @@ public:
 	static const double distP2PMax = 5.0;
 	static void fillVertexToTets();
 	static void fillTetToTet4();
+#endif
 };