diff --git a/lib/walberla/experimental/memory/MemoryTags.hpp b/lib/walberla/experimental/memory/MemoryTags.hpp
index f6c1f70ba7be55c43c1fdc8a6f54484b3675f194..902d7399f385e6b8dab559cfaa3731cda0ea7a16 100644
--- a/lib/walberla/experimental/memory/MemoryTags.hpp
+++ b/lib/walberla/experimental/memory/MemoryTags.hpp
@@ -5,6 +5,13 @@
 #include <concepts>
 #include <memory>
 
+#if defined(WALBERLA_BUILD_WITH_CUDA) || defined(WALBERLA_BUILD_WITH_HIP)
+
+#include "./UnifiedMemoryAllocator.hpp"
+
+#endif
+
+
 namespace walberla::experimental::memory
 {
 
@@ -52,8 +59,6 @@ struct SelectStandardAllocator< memtag::host >
 
 /* If CUDA or HIP are active, use the managed memory allocator for unified memory */
 
-#include "./UnifiedMemoryAllocator.hpp"
-
 template<>
 struct SelectStandardAllocator< memtag::unified >
 {
diff --git a/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp b/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp
index e30afecd51eb972e88fa43fe21a9376d059bc3b5..e08b16c0830d62b2f9f2809ece2554fc78bc5ca9 100644
--- a/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp
+++ b/lib/walberla/experimental/memory/UnifiedMemoryAllocator.hpp
@@ -1,13 +1,14 @@
 #pragma once
 
 #include "waLBerlaDefinitions.h"
+
+#if defined(WALBERLA_BUILD_WITH_CUDA) || defined(WALBERLA_BUILD_WITH_HIP)
+
 #include "gpu/GPUWrapper.h"
 #include "gpu/ErrorChecking.h"
 
 namespace walberla::experimental::memory
 {
-   
-#if defined(WALBERLA_BUILD_WITH_CUDA) || defined(WALBERLA_BUILD_WITH_HIP)
 
 /**
  * @brief Allocator for managed GPU memory.
@@ -44,6 +45,6 @@ class UnifiedMemoryAllocator
    }
 };
 
-#endif
-
 } // namespace walberla::experimental::memory
+
+#endif