From 5c87a33a8ae27248b03516379e02104f2e17b265 Mon Sep 17 00:00:00 2001 From: Dhanush Date: Sun, 15 Mar 2026 23:35:57 +0530 Subject: [PATCH] fix: add link_directories for tesseract/leptonica on macOS (#2186) pkg_check_modules provides library names without paths. Without link_directories, the linker cannot find tesseract and leptonica on systems where they are not in default search paths (e.g. Homebrew on macOS arm64). Co-authored-by: Dhanush Varma --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a449a065..b523b6de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -208,7 +208,9 @@ if (PKG_CONFIG_FOUND AND WITH_OCR) pkg_check_modules (LEPTONICA REQUIRED lept) set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_LIBRARIES}) + link_directories(${TESSERACT_LIBRARY_DIRS}) set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_LIBRARIES}) + link_directories(${LEPTONICA_LIBRARY_DIRS}) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR") endif (PKG_CONFIG_FOUND AND WITH_OCR) @@ -243,7 +245,9 @@ if (PKG_CONFIG_FOUND AND WITH_HARDSUBX) pkg_check_modules (LEPTONICA REQUIRED lept) set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_LIBRARIES}) + link_directories(${TESSERACT_LIBRARY_DIRS}) set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_LIBRARIES}) + link_directories(${LEPTONICA_LIBRARY_DIRS}) set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${TESSERACT_INCLUDE_DIRS}) set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${LEPTONICA_INCLUDE_DIRS})