--- plugins/memory/CMakeLists.txt.orig	2026-05-06 12:50:32 UTC
+++ plugins/memory/CMakeLists.txt
@@ -2,13 +2,13 @@
 # SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
 # SPDX-FileCopyrightText: 2021 Arjen Hiemstra <ahiemstra@heimr.nl>
 
-if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD|MidnightBSD")
     add_library(ksystemstats_plugin_memory MODULE memory.cpp backend.cpp)
 
     if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
         target_sources(ksystemstats_plugin_memory PRIVATE linuxbackend.cpp)
-    elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+    elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|MidnightBSD")
         target_sources(ksystemstats_plugin_memory PRIVATE freebsdbackend.cpp)
         target_link_libraries(ksystemstats_plugin_memory kvm)
     endif()
