From: Rylie Pavlik <rylie.pavlik@collabora.com>
Date: Wed, 23 Apr 2025 13:26:30 -0500
Subject: Make libmonado configurable separately

---
 CMakeLists.txt                        | 1 +
 src/xrt/targets/CMakeLists.txt        | 2 +-
 src/xrt/targets/openxr/CMakeLists.txt | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bacc19b..14c2086 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -275,6 +275,7 @@ option_with_deps(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" DEPENDS "NOT
 option_with_deps(XRT_FEATURE_TRACING "Enable debug tracing on supported platforms" DEFAULT OFF DEPENDS "XRT_HAVE_PERCETTO OR XRT_HAVE_TRACY")
 option_with_deps(XRT_FEATURE_WINDOW_PEEK "Enable a window that displays the content of the HMD on screen" DEPENDS XRT_HAVE_SDL2)
 option_with_deps(XRT_FEATURE_DEBUG_GUI "Enable debug window to be used" DEPENDS XRT_HAVE_SDL2)
+option_with_deps(XRT_FEATURE_LIBMONADO "Build the libmonado shared library for runtime control" DEPENDS XRT_FEATURE_SERVICE XRT_HAVE_LINUX)
 
 if (XRT_FEATURE_SERVICE)
 	# Disable the client debug gui by default for out-of-proc -
diff --git a/src/xrt/targets/CMakeLists.txt b/src/xrt/targets/CMakeLists.txt
index 3ffdf26..8d75586 100644
--- a/src/xrt/targets/CMakeLists.txt
+++ b/src/xrt/targets/CMakeLists.txt
@@ -8,7 +8,7 @@
 add_subdirectory(common)
 
 # Monado management library
-if(XRT_FEATURE_SERVICE AND XRT_HAVE_LINUX)
+if(XRT_FEATURE_LIBMONADO)
 	add_subdirectory(libmonado)
 endif()
 
diff --git a/src/xrt/targets/openxr/CMakeLists.txt b/src/xrt/targets/openxr/CMakeLists.txt
index 3d45227..0d1d462 100644
--- a/src/xrt/targets/openxr/CMakeLists.txt
+++ b/src/xrt/targets/openxr/CMakeLists.txt
@@ -65,7 +65,7 @@ else()
 endif()
 
 set(_libmonado_arg)
-if(TARGET monado)
+if(XRT_FEATURE_LIBMONADO AND TARGET monado)
 	set(_libmonado_arg LIBMONADO monado)
 endif()
 
