Skip to content

Commit 7bba4cf

Browse files
committed
Merge pull request #2093 from alalek:cmake_fix_pkgconfig_libs
2 parents c7f2e2a + fa4ef14 commit 7bba4cf

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

modules/freetype/CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@ if(APPLE_FRAMEWORK)
33
ocv_module_disable(freetype)
44
endif()
55

6-
if(PKG_CONFIG_FOUND)
7-
pkg_search_module(FREETYPE freetype2)
8-
pkg_search_module(HARFBUZZ harfbuzz)
9-
endif()
6+
ocv_check_modules(FREETYPE freetype2)
7+
ocv_check_modules(HARFBUZZ harfbuzz)
108

11-
if(NOT FREETYPE_FOUND)
12-
message(STATUS "freetype2: NO")
13-
else()
14-
message(STATUS "freetype2: YES")
15-
endif()
9+
if(OPENCV_INITIAL_PASS)
10+
if(NOT FREETYPE_FOUND)
11+
message(STATUS "freetype2: NO")
12+
else()
13+
message(STATUS "freetype2: YES (ver ${FREETYPE_VERSION})")
14+
endif()
1615

17-
if(NOT HARFBUZZ_FOUND)
18-
message(STATUS "harfbuzz: NO")
19-
else()
20-
message(STATUS "harfbuzz: YES")
16+
if(NOT HARFBUZZ_FOUND)
17+
message(STATUS "harfbuzz: NO")
18+
else()
19+
message(STATUS "harfbuzz: YES (ver ${HARFBUZZ_VERSION})")
20+
endif()
2121
endif()
2222

23-
24-
if( FREETYPE_FOUND AND HARFBUZZ_FOUND )
23+
if(FREETYPE_FOUND AND HARFBUZZ_FOUND)
2524
ocv_define_module(freetype opencv_core opencv_imgproc WRAP python)
2625
ocv_target_link_libraries(${the_module} ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES})
2726
ocv_include_directories( ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS} )

modules/text/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ set(the_description "Text Detection and Recognition")
22
ocv_define_module(text opencv_ml opencv_imgproc opencv_core opencv_features2d opencv_dnn OPTIONAL opencv_highgui WRAP python java)
33

44
if(NOT CMAKE_CROSSCOMPILING OR OPENCV_FIND_TESSERACT)
5-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
6-
find_package(Tesseract QUIET)
5+
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
6+
if(NOT Tesseract_FOUND)
7+
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindTesseract.cmake") # OpenCV's fallback
8+
endif()
79
if(Tesseract_FOUND)
8-
message(STATUS "Tesseract: YES")
10+
if(Tesseract_VERSION)
11+
message(STATUS "Tesseract: YES (ver ${Tesseract_VERSION})")
12+
else()
13+
message(STATUS "Tesseract: YES (ver unknown)")
14+
endif()
915
set(HAVE_TESSERACT 1)
1016
ocv_include_directories(${Tesseract_INCLUDE_DIRS})
1117
ocv_target_link_libraries(${the_module} ${Tesseract_LIBRARIES})

modules/text/cmake/FindTesseract.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Tesseract OCR
2-
if(COMMAND pkg_check_modules)
3-
pkg_check_modules(Tesseract tesseract lept)
4-
endif()
2+
ocv_check_modules(Tesseract tesseract) # lept is excluded (not a direct dependency)
53
if(NOT Tesseract_FOUND)
64
find_path(Tesseract_INCLUDE_DIR tesseract/baseapi.h
75
HINTS

0 commit comments

Comments
 (0)