--- vendor/CMakeLists.txt.orig	2026-06-21 14:11:27 UTC
+++ vendor/CMakeLists.txt
@@ -25,6 +25,8 @@ message(STATUS "Adding vendored libraries")

 message(STATUS "Adding vendored libraries")

+find_package(PkgConfig REQUIRED)
+
 ####################################################################################################
 # Dependencies used by ymir-core

@@ -37,20 +39,22 @@ message(STATUS "==> libfmt")

 # {fmt} - https://github.com/fmtlib/fmt
 message(STATUS "==> libfmt")
-set(FMT_MODULE OFF)
-add_subdirectory(fmt)
+find_package(fmt CONFIG REQUIRED GLOBAL)

 # concurrentqueue - https://github.com/cameron314/concurrentqueue
 message(STATUS "==> concurrentqueue")
-add_subdirectory(concurrentqueue EXCLUDE_FROM_ALL)
+find_package(concurrentqueue REQUIRED GLOBAL)
+add_library(concurrentqueue ALIAS concurrentqueue::concurrentqueue)
 
 # xxHash - https://github.com/Cyan4973/xxHash
 message(STATUS "==> xxHash")
-add_subdirectory(xxHash EXCLUDE_FROM_ALL)
+pkg_check_modules(libxxhash REQUIRED IMPORTED_TARGET GLOBAL libxxhash)
+add_library(xxHash::xxHash ALIAS PkgConfig::libxxhash)
 
 # libchdr - https://github.com/rtissera/libchdr
 message(STATUS "==> libchdr")
-add_subdirectory(libchdr)
+pkg_check_modules(libchdr REQUIRED IMPORTED_TARGET GLOBAL libchdr)
+add_library(chdr-static ALIAS PkgConfig::libchdr)
 
 ####################################################################################################
 # Other dependencies
@@ -59,12 +63,13 @@ if (NOT Ymir_LIBRARY_ONLY)
     # dear ImGui - https://github.com/ocornut/imgui
     # - Using the docking branch
     message(STATUS "==> dear ImGui")
-    add_subdirectory(imgui EXCLUDE_FROM_ALL)
+    find_package(imgui REQUIRED GLOBAL)

     # lz4 - https://github.com/lz4/lz4
     # - Unable to configure AVX2 support from vcpkg
     message(STATUS "==> lz4")
-    add_subdirectory(lz4 EXCLUDE_FROM_ALL)
+    pkg_check_modules(liblz4 REQUIRED IMPORTED_TARGET GLOBAL liblz4)
+    add_library(lz4::lz4 ALIAS PkgConfig::liblz4)
 endif ()

 # Place vendored library projects under a Vendored folder in Visual Studio solutions
