Skip to content

Commit bb87e7f

Browse files
author
Dhanush Varma
committed
fix: add link_directories for tesseract/leptonica on macOS
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).
1 parent 71ed87e commit bb87e7f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ if (PKG_CONFIG_FOUND AND WITH_OCR)
202202
pkg_check_modules (LEPTONICA REQUIRED lept)
203203

204204
set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_LIBRARIES})
205+
link_directories(${TESSERACT_LIBRARY_DIRS})
205206
set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_LIBRARIES})
207+
link_directories(${LEPTONICA_LIBRARY_DIRS})
206208

207209
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OCR")
208210
endif (PKG_CONFIG_FOUND AND WITH_OCR)
@@ -237,7 +239,9 @@ if (PKG_CONFIG_FOUND AND WITH_HARDSUBX)
237239
pkg_check_modules (LEPTONICA REQUIRED lept)
238240

239241
set (EXTRA_LIBS ${EXTRA_LIBS} ${TESSERACT_LIBRARIES})
242+
link_directories(${TESSERACT_LIBRARY_DIRS})
240243
set (EXTRA_LIBS ${EXTRA_LIBS} ${LEPTONICA_LIBRARIES})
244+
link_directories(${LEPTONICA_LIBRARY_DIRS})
241245

242246
set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${TESSERACT_INCLUDE_DIRS})
243247
set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${LEPTONICA_INCLUDE_DIRS})

0 commit comments

Comments
 (0)