cmake: fix travis build

This commit is contained in:
zdenop 2019-05-16 23:18:13 +02:00
parent 198bbe3df5
commit ca0be2fb72
2 changed files with 18 additions and 17 deletions

View File

@ -5,7 +5,7 @@ language: cpp
dist: trusty
env:
- LEPT_VER=1.77.0
- LEPT_VER=1.78.0
notifications:
email: false

View File

@ -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()
@ -142,27 +142,28 @@ 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()
if(Leptonica_DIR)
message(STATUS "Using Leptonica directory ${Leptonica_DIR} for build.")
else()
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION})
if (NOT Leptonica_FOUND)
find_package(PkgConfig)
if(PKG_CONFIG_EXECUTABLE)
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
link_directories(${Leptonica_LIBRARY_DIRS})
else()
message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
endif(PKG_CONFIG_EXECUTABLE)
endif()
endif()
endif()
find_package(OpenCL QUIET)