--- source/CMakeLists.txt.orig	2021-11-01 04:27:52 UTC
+++ source/CMakeLists.txt
@@ -105,21 +105,24 @@ else()
 endif()
 
 # System MIDI support
-if(WIN32)
-	target_compile_definitions(zmusic-obj INTERFACE HAVE_SYSTEM_MIDI)
-	target_link_libraries(zmusic-obj INTERFACE winmm)
-	target_sources(zmusic-obj INTERFACE mididevices/music_win_mididevice.cpp)
-elseif(NOT APPLE)
-	find_package(ALSA)
-    if(ALSA_FOUND)
+option(SYSTEM_MIDI "Use system MIDI support" ON)
+if(SYSTEM_MIDI)
+	if(WIN32)
 		target_compile_definitions(zmusic-obj INTERFACE HAVE_SYSTEM_MIDI)
-		target_sources(zmusic-obj
-		INTERFACE
-			mididevices/music_alsa_mididevice.cpp
-			mididevices/music_alsa_state.cpp
-		)
-		target_link_libraries(zmusic-obj INTERFACE ALSA::ALSA)
-		determine_package_config_dependency(ZMUSIC_PACKAGE_DEPENDENCIES TARGET ALSA::ALSA MODULE ALSA)
+		target_link_libraries(zmusic-obj INTERFACE winmm)
+		target_sources(zmusic-obj INTERFACE mididevices/music_win_mididevice.cpp)
+	elseif(NOT APPLE)
+		find_package(ALSA)
+		if(ALSA_FOUND)
+			target_compile_definitions(zmusic-obj INTERFACE HAVE_SYSTEM_MIDI)
+			target_sources(zmusic-obj
+			INTERFACE
+				mididevices/music_alsa_mididevice.cpp
+				mididevices/music_alsa_state.cpp
+			)
+			target_link_libraries(zmusic-obj INTERFACE ALSA::ALSA)
+			determine_package_config_dependency(ZMUSIC_PACKAGE_DEPENDENCIES TARGET ALSA::ALSA MODULE ALSA)
+		endif()
 	endif()
 endif()
 
