--- CMakeLists.txt	2025-08-18 19:25:02.000000000 +0800
+++ CMakeLists.txt	2026-02-10 01:14:14.000000000 +0800
@@ -1,7 +1,6 @@
 cmake_minimum_required(VERSION 3.16)
 project(NewLastReader CXX C)
 
-set(CMAKE_OSX_ARCHITECTURES "arm64")
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
@@ -97,9 +96,7 @@
 
     endif()
 
-# --- Common Dependencies (Always fetched) ---
-find_package(ZLIB REQUIRED)
-FetchContent_Declare(libzip_content GIT_REPOSITORY https://github.com/nih-at/libzip.git GIT_TAG v1.10.1)
+# --- Common Dependencies ---
 set(ENABLE_TOOLS OFF CACHE BOOL "" FORCE)
 set(ENABLE_REGRESS OFF CACHE BOOL "" FORCE)
 set(ENABLE_EXAMPLES OFF CACHE BOOL "" FORCE)
@@ -110,36 +107,12 @@
 set(ENABLE_GNUTLS OFF CACHE BOOL "" FORCE)
 set(ENABLE_MBEDTLS OFF CACHE BOOL "" FORCE)
 set(ENABLE_OPENSSL OFF CACHE BOOL "" FORCE)
-FetchContent_MakeAvailable(libzip_content)
-
-FetchContent_Declare(gumbo_content GIT_REPOSITORY https://github.com/google/gumbo-parser.git GIT_TAG v0.10.1)
-FetchContent_MakeAvailable(gumbo_content)
-add_library(gumbo STATIC
-    ${gumbo_content_SOURCE_DIR}/src/attribute.c
-    ${gumbo_content_SOURCE_DIR}/src/char_ref.c
-    ${gumbo_content_SOURCE_DIR}/src/error.c
-    ${gumbo_content_SOURCE_DIR}/src/parser.c
-    ${gumbo_content_SOURCE_DIR}/src/string_buffer.c
-    ${gumbo_content_SOURCE_DIR}/src/string_piece.c
-    ${gumbo_content_SOURCE_DIR}/src/tag.c
-    ${gumbo_content_SOURCE_DIR}/src/tokenizer.c
-    ${gumbo_content_SOURCE_DIR}/src/utf8.c
-    ${gumbo_content_SOURCE_DIR}/src/util.c
-    ${gumbo_content_SOURCE_DIR}/src/vector.c
-)
-target_include_directories(gumbo PUBLIC ${gumbo_content_SOURCE_DIR}/src)
-
-FetchContent_Declare(tinyxml2 GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git GIT_TAG 10.0.0)
-FetchContent_MakeAvailable(tinyxml2)
 
-FetchContent_Declare(sqlite3_content URL https://www.sqlite.org/2023/sqlite-amalgamation-3420000.zip)
-FetchContent_MakeAvailable(sqlite3_content)
-add_library(sqlite3_lib STATIC 
-    ${sqlite3_content_SOURCE_DIR}/sqlite3.c
-)
-target_include_directories(sqlite3_lib PUBLIC 
-    ${sqlite3_content_SOURCE_DIR}
-)
+find_package(ZLIB REQUIRED)
+find_package(libzip REQUIRED)
+pkg_check_modules(gumbo-parser REQUIRED gumbo)
+find_package(tinyxml2 REQUIRED)
+find_package(sqlite3 REQUIRED)
 
 # --- Add library directories before creating executable (for dynamic build) ---
 if(NOT STATIC_BUILD)
@@ -180,7 +153,6 @@
 # --- Include Directories ---
 target_include_directories(${EXECUTABLE_NAME} PUBLIC 
     ${CMAKE_CURRENT_SOURCE_DIR}/src
-    ${gumbo_content_SOURCE_DIR}/src
 )
 if(NOT STATIC_BUILD)
     target_include_directories(${EXECUTABLE_NAME} PUBLIC 
@@ -194,7 +166,6 @@
 # Add definitions to handle non-standard C keywords (_Nullable, _Nonnull) from libzip headers
 target_compile_definitions(${EXECUTABLE_NAME} PRIVATE "_Nullable=" "_Nonnull=")
 
-
 # --- Linking Libraries ---
 target_link_libraries(${EXECUTABLE_NAME}
   PRIVATE
@@ -202,7 +173,7 @@
   zip
   gumbo
   tinyxml2
-  sqlite3_lib
+  sqlite3
 )
 if(STATIC_BUILD)
     target_link_libraries(${EXECUTABLE_NAME} PRIVATE ftxui::screen ftxui::dom ftxui::component mobi)
