From f22e90f6194a6f80b5da52a81a1344fd66fd06d3 Mon Sep 17 00:00:00 2001 From: yangjie01 Date: Fri, 22 May 2026 15:54:38 +0800 Subject: [PATCH] fix(cmake): add IOKit framework to APPLE link line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `sysinfo` (pulled in transitively via the lance crates) calls IOKit on macOS for disk enumeration, CPU frequency, and thermal sensors; `objc2_io_kit` declares the framework binding. Cargo's `rustc-link-lib=framework=IOKit` is honored when this repo builds, but consumers linking against the installed `liblance_c.a` via `find_package(LanceC)` (or pkg-config) only see the frameworks we declare in our config files — and IOKit was missing. Add `-framework IOKit` next to the existing `CoreFoundation` / `Security` / `SystemConfiguration` entries in all three places: build-tree `LanceC_platform_deps`, installed `LanceCConfig.cmake.in`, and the pkg-config `Libs.private`. --- CMakeLists.txt | 3 ++- cmake/LanceCConfig.cmake.in | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8a0aa6..6960752 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ add_library(LanceC_platform_deps INTERFACE) if(APPLE) target_link_libraries(LanceC_platform_deps INTERFACE "-framework CoreFoundation" + "-framework IOKit" "-framework Security" "-framework SystemConfiguration") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") @@ -146,7 +147,7 @@ install(FILES # ─── pkg-config ────────────────────────────────────────────────────────────── if(APPLE) set(LANCE_C_PC_LIBS_PRIVATE - "-framework CoreFoundation -framework Security -framework SystemConfiguration") + "-framework CoreFoundation -framework IOKit -framework Security -framework SystemConfiguration") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(LANCE_C_PC_LIBS_PRIVATE "-lpthread -ldl -lm") else() diff --git a/cmake/LanceCConfig.cmake.in b/cmake/LanceCConfig.cmake.in index 3c26b9e..6f726e9 100644 --- a/cmake/LanceCConfig.cmake.in +++ b/cmake/LanceCConfig.cmake.in @@ -14,6 +14,7 @@ set(_lance_c_platform_deps "") if(APPLE) list(APPEND _lance_c_platform_deps "-framework CoreFoundation" + "-framework IOKit" "-framework Security" "-framework SystemConfiguration") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")