mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-19 06:53:36 +08:00
cmake: backport master changes
This commit is contained in:
parent
5d23dfa5ce
commit
9897bc9c8d
@ -46,7 +46,7 @@ string(REGEX REPLACE "^([^.]*)\\..*" "\\1" VERSION_MAJOR ${VERSION_PLAIN})
|
||||
string(REGEX REPLACE "^[^.]*\\.([^.]*)\\..*" "\\1" VERSION_MINOR ${VERSION_PLAIN})
|
||||
string(REGEX REPLACE "^[^.]*\\.[^.]*\\.([0-9]*).*" "\\1" VERSION_PATCH ${VERSION_PLAIN})
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||
execute_process(COMMAND git describe --abbrev=4
|
||||
execute_process(COMMAND git --git-dir ${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=4
|
||||
OUTPUT_VARIABLE GIT_REV)
|
||||
string(REGEX REPLACE "\n$" "" PACKAGE_VERSION "${GIT_REV}")
|
||||
endif()
|
||||
@ -151,27 +151,24 @@ endif()
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
if(NOT CPPAN_BUILD AND NOT Leptonica_DIR)
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} CONFIG QUIET)
|
||||
if (NOT Leptonica_FOUND)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_EXECUTABLE)
|
||||
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
|
||||
link_directories(${Leptonica_LIBRARY_DIRS})
|
||||
endif(PKG_CONFIG_EXECUTABLE)
|
||||
# message ("Leptonica: ${Leptonica_LIBRARY_DIRS}, ${Leptonica_FOUND}")
|
||||
|
||||
if (NOT Leptonica_FOUND)
|
||||
message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(CPPAN_BUILD)
|
||||
if (STATIC)
|
||||
set(CPPAN_BUILD_SHARED_LIBS 0)
|
||||
else()
|
||||
set(CPPAN_BUILD_SHARED_LIBS 1)
|
||||
endif()
|
||||
add_subdirectory(.cppan)
|
||||
else()
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_EXECUTABLE AND NOT Leptonica_DIR)
|
||||
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
|
||||
link_directories(${Leptonica_LIBRARY_DIRS})
|
||||
else()
|
||||
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG)
|
||||
endif()
|
||||
if (NOT Leptonica_FOUND)
|
||||
message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
|
||||
endif(NOT Leptonica_FOUND)
|
||||
endif()
|
||||
|
||||
find_package(OpenCL QUIET)
|
||||
|
Loading…
Reference in New Issue
Block a user