1
# - Try to find Tesseract-OCR 3.00 (not for 2.04)
2
# Once done, this will define
4
# Tesseract_FOUND - system has Tesseract
5
# Tesseract_INCLUDE_DIRS - the Tesseract include directories
6
# Tesseract_LIBRARIES - link these to use Tesseract
8
find_path(Tesseract_DIR "include/tesseract/baseapi.h" DOC "Root directory of Tesseract-OCR")
10
include(LibFindMacros)
12
# Use pkg-config to get hints about paths
13
libfind_pkg_check_modules(Tesseract_PKGCONF Tesseract)
16
find_path(Tesseract_INCLUDE_DIR
17
NAMES tesseract/baseapi.h
18
HINTS "${Tesseract_DIR}/include"
21
${Tesseract_PKGCONF_INCLUDE_DIRS}
24
SET(TESSERACT_COMPONENTS
25
api cutil textord ccstruct dict training ccutil
26
image viewer classify main wordrec
29
FOREACH(LIB ${TESSERACT_COMPONENTS})
30
find_library(Tesseract_${LIB}_LIBRARY
31
NAMES libtesseract_${LIB}.a
32
HINTS "${Tesseract_DIR}/lib"
35
${Tesseract_PKGCONF_LIBRARY_DIRS}
38
set(Tesseract_LIBRARY ${Tesseract_LIBRARY} ${Tesseract_${LIB}_LIBRARY})
39
ENDFOREACH(LIB ${TESSERACT_COMPONENTS})
42
# Set the include dir variables and the libraries and let libfind_process do the rest.
43
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
44
set(Tesseract_PROCESS_INCLUDES Tesseract_INCLUDE_DIR Tesseract_INCLUDE_DIRS)
45
set(Tesseract_PROCESS_LIBS Tesseract_LIBRARY Tesseract_LIBRARIES)
46
libfind_process(Tesseract)