From a914e33a2807a900ee8360c1eec0941348b2d940 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Thu, 21 May 2020 10:18:35 -0400
Subject: [PATCH] cmake: add a flag for building remote modules

---
 CMakeLists.txt             | 13 ++++++++++++-
 Documentation/dev/build.md |  3 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 32e7ac35bab..246e0d87880 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,7 +221,6 @@ set(vtk_source_directories
   "${CMAKE_CURRENT_SOURCE_DIR}/Interaction"
   "${CMAKE_CURRENT_SOURCE_DIR}/IO"
   "${CMAKE_CURRENT_SOURCE_DIR}/Parallel"
-  "${CMAKE_CURRENT_SOURCE_DIR}/Remote"
   "${CMAKE_CURRENT_SOURCE_DIR}/Rendering"
   "${CMAKE_CURRENT_SOURCE_DIR}/Testing"
   "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty"
@@ -229,6 +228,18 @@ set(vtk_source_directories
   "${CMAKE_CURRENT_SOURCE_DIR}/Views"
   "${CMAKE_CURRENT_SOURCE_DIR}/Web"
   "${CMAKE_CURRENT_SOURCE_DIR}/Wrapping")
+
+set(remote_default ON)
+if (VTK_WHEEL_BUILD)
+  set(remote_default OFF)
+endif ()
+option(VTK_ENABLE_REMOTE_MODULES "Enable remote modules" ON)
+mark_as_advanced(VTK_ENABLE_REMOTE_MODULES)
+if (VTK_ENABLE_REMOTE_MODULES)
+  list(APPEND vtk_source_directories
+    "${CMAKE_CURRENT_SOURCE_DIR}/Remote")
+endif ()
+
 vtk_module_find_modules(vtk_module_files ${vtk_source_directories})
 vtk_module_find_kits(vtk_kit_files ${vtk_source_directories})
 
diff --git a/Documentation/dev/build.md b/Documentation/dev/build.md
index dd7f06767b3..619542fd05a 100644
--- a/Documentation/dev/build.md
+++ b/Documentation/dev/build.md
@@ -176,6 +176,9 @@ More advanced options:
     documentation using Doxygen.
   * `VTK_BUILD_ALL_MODULES` (default `OFF`): If set, VTK will enable all
     modules not disabled by other features.
+  * `VTK_ENABLE_REMOTE_MODULES` (default `ON`): If set, VTK will try to build
+    remote modules (the `Remote` directory). If unset, no remote modules will
+    build.
   * `VTK_USE_EXTERNAL` (default `OFF`): Whether to prefer external third
     party libraries or the versions VTK's source contains.
   * `VTK_VERSIONED_INSTALL` (default `ON`): Whether to add version numbers to
-- 
GitLab