diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt
index bbdd495fe01748cf6935b0219a910dd729cb55cb..072823a8d08070bbeb01a4800153671ba0e54c52 100644
--- a/Common/CMakeLists.txt
+++ b/Common/CMakeLists.txt
@@ -26,12 +26,12 @@ set(SRC
   GamePad.cpp
 )
 
-if(NOT ENABLE_ONELAB2)
+if(ENABLE_ONELAB AND NOT ENABLE_ONELAB2)
   set(SRC
     ${SRC}
     gmshLocalNetworkClient.cpp
   )
-endif(NOT ENABLE_ONELAB2)
+endif(ENABLE_ONELAB AND NOT ENABLE_ONELAB2)
 
 file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) 
 append_gmsh_src(Common "${SRC};${HDR}")
diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp
index ffd8a5078b4d1b090afc548223b7e0b6c89713c6..b4351fccd4973bd04c33af8d210dcf551cdae085 100644
--- a/Common/Gmsh.cpp
+++ b/Common/Gmsh.cpp
@@ -278,7 +278,9 @@ int GmshBatch()
   }
 
   // launch solver (if requested)
+#if defined(HAVE_ONELAB)
   solver_batch_cb((void*)CTX::instance()->launchSolverAtStartup);
+#endif
 
   time_t now;
   time(&now);