3

I'm tryint to use tesseract in my cmake project on Windows. I installed tesseract 5.0 and tesseract 4.0. They both come with no cmake folder so the line

find_package(Tesseract REQUIRED)

produces

CMake Error at CMakeLists.txt:14 (find_package):
  By not providing "FindTesseract.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Tesseract", but CMake did not find one.

  Could not find a package configuration file provided by "Tesseract"
  (requested version 4.0) with any of the following names:

    TesseractConfig.cmake
    tesseract-config.cmake

  Add the installation prefix of "Tesseract" to CMAKE_PREFIX_PATH or set
  "Tesseract_DIR" to a directory containing one of the above files.  If
  "Tesseract" provides a separate development package or SDK, be sure it has
  been installed.

However, in the installation folder for tesseract 5.0, there's libtesseract-5.dll and many others. Can I link those in my cmake project? If so, how? And why there are no include files in the installation folder? How am I suppose to include the .h files in my project?

Guerlando OCs
  • 1,886
  • 9
  • 61
  • 150
  • 1
    How did you installed tesseract? – user898678 Feb 28 '20 at 07:30
  • "*They both come with no cmake folder*"... This is odd. The GitHub [repo](https://github.com/tesseract-ocr/tesseract) shows there should be a `cmake` folder. How did you install tesseract? – Kevin Feb 28 '20 at 12:15
  • I guess this question is just a continuation of the previous [one](https://stackoverflow.com/questions/60426500/how-to-make-cmake-find-tesseract-library-in-windows-findtesseract-cmake) asked be the same author. And I wonder whether these both questions are actually about the **same problem**. – Tsyvarev Feb 28 '20 at 16:55
  • @user898678 I installed through here: https://github.com/UB-Mannheim/tesseract/wiki the version 5.0.0 which does not come with cmake and also through here https://tesseract-ocr.github.io/tessdoc/4.0-with-LSTM.html#400-alpha-for-windows in "Windows Installer made with MinGW-w64 from UB Mannheim" which also does not come with cmake – Guerlando OCs Feb 28 '20 at 18:34
  • @squareskittles there's a cmake folder in the repo, but I think it's for compiling the project with cmake, it's not the folder that is placed into the installation folder – Guerlando OCs Feb 28 '20 at 20:12
  • Can you show your *CMakeLists.txt* (at least the parts that reference *Tesseract*)? – CristiFati Mar 01 '20 at 20:15
  • @CristiFati it's just a minimum cmake with `find_package(Tesseract REQUIRED)`, just to see if it'll find them – Guerlando OCs Mar 01 '20 at 22:41
  • Ok, then the question doesn't make too much sense. There are alternative ways for *find\_package* (you'll still have to build *Tesseract*), but you'll need to provide a specific usecase. – CristiFati Mar 04 '20 at 12:42

2 Answers2

0

UB-Mannheim installer is autotools build and it has only runtime part of tesseract (e.g. executables and linked libraries). You can not use it for any development because it does not provide needed files (libraries and header files), so missing cmake files are reasonable consequences of this installation. You can check this information in detail where installer finished.

user898678
  • 2,994
  • 2
  • 18
  • 17
0

Have you tried using the MSYS/Mingw build of tesseract: pacman -S mingw-w64-x86_64-tesseract-ocr? Since there is no cmake config file you will have to use pkg_check_modules instead (see also cMakefile for using tesseract and opencv without the opencv bit)

till
  • 570
  • 1
  • 6
  • 22