Using tesseract with cmake to make a cpp file

43 views
Skip to first unread message

Adam Richards

unread,
Sep 30, 2018, 2:13:31 AM9/30/18
to tesseract-ocr
Hi I have a previous thread discussing more of my project but still after googling have no idea what I am doing and was wondering if anybody else could help.

I installed tesseract using:
sudo apt install tesseract-ocr 
sudo apt install libtesseract-dev

I can run the sample code from https://github.com/tesseract-ocr/tesseract/wiki/APIExample using the g++ command
Now what is a simple way for me to run this same code inside my project that is currently being built with cmake?

From what I can understand I need some commands in my cmakelists.txt file like these:

#find_package( Tesseract 3.04.01 REQUIRED )
#include_directories(${Tesseract_INCLUDE_DIRS})
#target_link_libraries(image ${Tesseract_LIBRARIES})

That gives me the error of :
"CMake Error at CMakeLists.txt:7 (find_package):
  Could not find a package configuration file provided by "Tesseract" 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."

so I tried manually entering the directories like this:
include_directories(${/usr/include/tesseract})
target_link_libraries(image ${/usr/local/lib})
 
However it comes up with a whole bunch of undefined references.

Is this how I should be doing it? How can I find the correct directories? What should I enter? 

Can somebody please help?
Thanks, Adam


Reply all
Reply to author
Forward
0 new messages