1. 程式人生 > >OpenCV + Leptonica + Tesseract 項目的 CMakeLists.txt 示例

OpenCV + Leptonica + Tesseract 項目的 CMakeLists.txt 示例

under make tab AS add targe 目的 instead main.c

cmake_minimum_required(VERSION 3.9)
project(A5)
set(CMAKE_CXX_STANDARD 11)

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

find_package(Leptonica REQUIRED)
include_directories(${Leptonica_INCLUDE_DIRS})

find_package(Tesseract REQUIRED)
include_directories(${Tesseract_INCLUDE_DIRS})

add_executable(A5 main.cpp)

target_link_libraries(A5 ${OpenCV_LIBS})
target_link_libraries(A5 ${Leptonica_LIBRARIES})

## If your tesseract is under 4.0.0-beta.1, you need `libtesseract` instead of `${Tesseract_LIBRARIES}`.
## Detail you can see: https://github.com/tesseract-ocr/tesseract/commit/000d027a9f40e17c9a90a907fa9e4a16616e61a0
target_link_libraries(A5 libtesseract)
#target_link_libraries(A5 ${Tesseract_LIBRARIES})

OpenCV + Leptonica + Tesseract 項目的 CMakeLists.txt 示例