gem/tests/native_dependency_guard.cmake
2026-08-30 18:24:55 -06:00

15 lines
468 B
CMake

if(NOT DEFINED NATIVE_BINARY)
message(FATAL_ERROR "NATIVE_BINARY is required")
endif()
execute_process(
COMMAND otool -L "${NATIVE_BINARY}"
RESULT_VARIABLE result
OUTPUT_VARIABLE libraries
ERROR_VARIABLE error)
if(NOT result EQUAL 0)
message(FATAL_ERROR "otool failed: ${error}")
endif()
if(libraries MATCHES "(libllama|libggml|llama-server)")
message(FATAL_ERROR "native binary has a forbidden runtime dependency:\n${libraries}")
endif()