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 <your@email.com>
This commit is contained in:
Dhanush
2026-03-15 23:35:57 +05:30
committed by GitHub
parent 6281a481d0
commit 5c87a33a8a

View File

@@ -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})