diff --git a/Applications/DataExplorer/Base/ImportFileTypes.h b/Applications/DataExplorer/Base/ImportFileTypes.h
index 07da7430e8599e2fe35cc2ea9d01ea5db1cfed2e..d5cad3909bf6765a0b923e1fbd3e1fc394b19a0c 100644
--- a/Applications/DataExplorer/Base/ImportFileTypes.h
+++ b/Applications/DataExplorer/Base/ImportFileTypes.h
@@ -22,8 +22,8 @@
 class ImportFileType
 {
 public:
-
-    enum type {
+    enum type
+    {
         OGS = 0,
         OGS_GEO,
         OGS_STN,
@@ -31,7 +31,9 @@ public:
         FEFLOW,
         GMS,
         GMSH,
+#ifdef OGS_USE_NETCDF
         NETCDF,
+#endif  // OGS_USE_NETCDF
         PETREL,
         POLYRASTER,
         RASTER,
@@ -48,8 +50,10 @@ public:
             return "GMS";
         if (t == ImportFileType::GMSH)
             return "GMSH";
+#ifdef OGS_USE_NETCDF
         if (t == ImportFileType::NETCDF)
             return "NetCDF";
+#endif  // OGS_USE_NETCDF
         if (t == ImportFileType::OGS)
             return "OGS";
         if (t == ImportFileType::OGS_GEO)
@@ -80,8 +84,10 @@ public:
             return "GMS files (*.txt *.3dm)";
         if (t == ImportFileType::GMSH)
             return "GMSH mesh files (*.msh)";
+#ifdef OGS_USE_NETCDF
         if (t == ImportFileType::NETCDF)
             return "NetCDF files (*.nc)";
+#endif  // OGS_USE_NETCDF
         if (t == ImportFileType::OGS)
             return "OpenGeosys files (*.prj *.gml *.vtu *.stn);;GeoSys legacy "
                    "files (*.gli *.msh);;All files (* *.*)";
diff --git a/Applications/DataExplorer/CMakeLists.txt b/Applications/DataExplorer/CMakeLists.txt
index e1400149be3415e28a03dc6752401125bd5f2edc..005036f32b19a6a7cdf8710928cab730348f2b30 100644
--- a/Applications/DataExplorer/CMakeLists.txt
+++ b/Applications/DataExplorer/CMakeLists.txt
@@ -24,7 +24,6 @@ add_subdirectory(Base)
 add_subdirectory(DataView/StratView)
 add_subdirectory(DataView)
 add_subdirectory(DataView/DiagramView)
-add_subdirectory(NetCdfDialog)
 add_subdirectory(VtkVis)
 include(DataExplorer.cmake)
 
diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index 31a26ec59eb6b42cf85b0394b8f9b9814fabb4eb..680d316c696095d7ae1f97c7690c74727e59eb24 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -37,7 +37,6 @@ target_link_libraries(DataExplorer
     MeshLib
     ApplicationsFileIO
     DataHolderLib
-    NetCdfDialogLib
     OGSFileConverterLib
     QtBase
     QtDataView
@@ -53,6 +52,13 @@ target_link_libraries(DataExplorer
     ${VTK_LIBRARIES}
 )
 
+
+if(OGS_USE_NETCDF)
+    add_definitions(-DOGS_USE_NETCDF)
+    add_subdirectory(NetCdfDialog)
+    target_link_libraries(DataExplorer NetCdfDialogLib)
+endif()
+
 if(NOT APPLE AND OGS_USE_CONAN)
     # HACK for unresolved external
     target_link_libraries(DataExplorer vtkGUISupportQt-8.1)
diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt
index c3da20000a756325322addbf3722f45b96e53926..f873f6c550e34b9735fb6fee772a7255e3d104ed 100644
--- a/Applications/DataExplorer/VtkVis/CMakeLists.txt
+++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt
@@ -138,9 +138,14 @@ if(GEOTIFF_FOUND)
 endif() # GEOTIFF_FOUND
 
 target_link_libraries(VtkVis
-    PUBLIC BaseLib GeoLib MeshLib DataHolderLib QtBase vtkIOImage NetCdfDialogLib
+    PUBLIC BaseLib GeoLib MeshLib DataHolderLib QtBase vtkIOImage
     PRIVATE MathLib ApplicationsFileIO Qt5::Gui logog
 )
+
+if (OGS_USE_NETCDF)
+    target_link_libraries(VtkVis PRIVATE NetCdfDialogLib)
+endif()
+
 if(NOT APPLE AND OGS_USE_CONAN)
     # HACK for unresolved external
     target_link_libraries(VtkVis PUBLIC vtkGUISupportQt-8.1)
diff --git a/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp b/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp
index 581eb95c1eeda4979d8a53ffb7ff10651dbdb76a..5815a39ac21a7fed5a01754a311f31362ac1608d 100644
--- a/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp
+++ b/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp
@@ -23,7 +23,9 @@
 #include <vtkUnstructuredGrid.h>
 #include "VtkGeoImageSource.h"
 #include "VtkRaster.h"
+#ifdef OGS_USE_NETCDF
 #include "NetCdfDialog/NetCdfConfigureDialog.h"
+#endif  // OGS_USE_NETCDF
 
 #include <QFileDialog>
 #include <QFileInfo>
@@ -61,9 +63,14 @@ void VtkCompositeTextureOnSurfaceFilter::init()
 
     QWidget* parent = nullptr;
     QSettings settings;
-    QString fileName = QFileDialog::getOpenFileName(parent, "Select raster file to apply as texture",
-                                                    settings.value("lastOpenedTextureFileDirectory").toString(),
-                                                    "Raster files (*.asc *.grd *.bmp *.jpg *.png *.tif);;NetCDF files (*.nc);;");
+    QString fileName = QFileDialog::getOpenFileName(
+        parent, "Select raster file to apply as texture",
+        settings.value("lastOpenedTextureFileDirectory").toString(),
+        "Raster files (*.asc *.grd *.bmp *.jpg *.png *.tif);;"
+#ifdef OGS_USE_NETCDF
+        "NetCDF files (*.nc);;"
+#endif  // OGS_USE_NETCDF
+    );
     QFileInfo fi(fileName);
 
     if ((fi.suffix().toLower() == "asc") || (fi.suffix().toLower() == "tif") ||
@@ -79,6 +86,7 @@ void VtkCompositeTextureOnSurfaceFilter::init()
         QDir dir = QDir(fileName);
         settings.setValue("lastOpenedTextureFileDirectory", dir.absolutePath());
     }
+#ifdef OGS_USE_NETCDF
     else if (fi.suffix().toLower() == "nc")
     {
         NetCdfConfigureDialog dlg(fileName.toStdString().c_str());
@@ -94,6 +102,7 @@ void VtkCompositeTextureOnSurfaceFilter::init()
             surface->Update();
         }
     }
+#endif  // OGS_USE_NETCDF
     else
         ERR("VtkCompositeTextureOnSurfaceFilter::init(): Error reading texture file.");
 
diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp
index 21f70d3fb8d5cbaef37967cdecdbf55ec1412b92..b2bfd185853a7f646fee744af3cc298ba17e55ac 100644
--- a/Applications/DataExplorer/mainwindow.cpp
+++ b/Applications/DataExplorer/mainwindow.cpp
@@ -73,7 +73,9 @@
 #include "MeshAnalysisDialog.h"
 #include "MeshElementRemovalDialog.h"
 #include "MeshQualitySelectionDialog.h"
+#ifdef OGS_USE_NETCDF
 #include "NetCdfDialog/NetCdfConfigureDialog.h"
+#endif  // OGS_USE_NETCDF
 #include "SHPImportDialog.h"
 #include "SetNameDialog.h"
 #include "VtkAddFilterDialog.h"
@@ -609,6 +611,7 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName)
         }
         settings.setValue("lastOpenedFileDirectory", dir.absolutePath());
     }
+#ifdef OGS_USE_NETCDF
     else if (t == ImportFileType::NETCDF)    // CH  01.2012
     {
 
@@ -625,6 +628,7 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName)
 
         settings.setValue("lastOpenedRasterFileDirectory", dir.absolutePath());
     }
+#endif  // OGS_USE_NETCDF
     else if (t == ImportFileType::RASTER)
     {
         VtkGeoImageSource* geoImage = VtkGeoImageSource::New();
@@ -748,9 +752,11 @@ QMenu* MainWindow::createImportFilesMenu()
     QAction* gmshFiles = importFiles->addAction("&GMSH Files...");
     connect(gmshFiles, SIGNAL(triggered()), signal_mapper, SLOT(map()));
     signal_mapper->setMapping(gmshFiles, ImportFileType::GMSH);
+#ifdef OGS_USE_NETCDF
     QAction* netcdfFiles = importFiles->addAction("&NetCDF Files...");
     connect(netcdfFiles, SIGNAL(triggered()), signal_mapper, SLOT(map()));
     signal_mapper->setMapping(netcdfFiles, ImportFileType::NETCDF);
+#endif  // OGS_USE_NETCDF
     QAction* petrelFiles = importFiles->addAction("&Petrel Files...");
     connect(petrelFiles, SIGNAL(triggered()), this, SLOT(loadPetrelFiles()));
     QAction* rasterFiles = importFiles->addAction("&Raster Files...");
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55be3c9d3b34e7197e081742e7bb98d8b785fa02..e1aa10ca985e0c8123b50811a680957beb1c613b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,7 @@ option(OGS_BUILD_CLI "Should the OGS simulator be built?" ON)
 option(OGS_BUILD_GUI "Should the Data Explorer be built?" OFF)
 if(OGS_BUILD_GUI)
     add_definitions(-DOGS_BUILD_GUI)
+    option(OGS_USE_NETCDF "Add NetCDF support." ON)
 endif()
 option(OGS_BUILD_UTILS "Should the utilities programms be built?" OFF)