Skip to content

Commit ca0be2f

Browse files
committed
cmake: fix travis build
1 parent 198bbe3 commit ca0be2f

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ language: cpp
55
dist: trusty
66

77
env:
8-
- LEPT_VER=1.77.0
8+
- LEPT_VER=1.78.0
99

1010
notifications:
1111
email: false

CMakeLists.txt

+17-16
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ string(REGEX REPLACE "^([^.]*)\\..*" "\\1" VERSION_MAJOR ${VERSION_PLAIN})
4646
string(REGEX REPLACE "^[^.]*\\.([^.]*)\\..*" "\\1" VERSION_MINOR ${VERSION_PLAIN})
4747
string(REGEX REPLACE "^[^.]*\\.[^.]*\\.([0-9]*).*" "\\1" VERSION_PATCH ${VERSION_PLAIN})
4848
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
49-
execute_process(COMMAND git describe --abbrev=4
49+
execute_process(COMMAND git --git-dir ${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=4
5050
OUTPUT_VARIABLE GIT_REV)
5151
string(REGEX REPLACE "\n$" "" PACKAGE_VERSION "${GIT_REV}")
5252
endif()
@@ -142,27 +142,28 @@ endif()
142142
#
143143
###############################################################################
144144

145-
if(NOT CPPAN_BUILD AND NOT Leptonica_DIR)
146-
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} CONFIG QUIET)
147-
if (NOT Leptonica_FOUND)
148-
find_package(PkgConfig QUIET)
149-
if(PKG_CONFIG_EXECUTABLE)
150-
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
151-
link_directories(${Leptonica_LIBRARY_DIRS})
152-
endif(PKG_CONFIG_EXECUTABLE)
153-
# message ("Leptonica: ${Leptonica_LIBRARY_DIRS}, ${Leptonica_FOUND}")
154-
155-
if (NOT Leptonica_FOUND)
156-
message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
157-
endif()
158-
endif()
159-
else()
145+
if(CPPAN_BUILD)
160146
if (STATIC)
161147
set(CPPAN_BUILD_SHARED_LIBS 0)
162148
else()
163149
set(CPPAN_BUILD_SHARED_LIBS 1)
164150
endif()
165151
add_subdirectory(.cppan)
152+
else()
153+
if(Leptonica_DIR)
154+
message(STATUS "Using Leptonica directory ${Leptonica_DIR} for build.")
155+
else()
156+
find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION})
157+
if (NOT Leptonica_FOUND)
158+
find_package(PkgConfig)
159+
if(PKG_CONFIG_EXECUTABLE)
160+
pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION})
161+
link_directories(${Leptonica_LIBRARY_DIRS})
162+
else()
163+
message(FATAL_ERROR "Cannot find required library Leptonica. Quitting!")
164+
endif(PKG_CONFIG_EXECUTABLE)
165+
endif()
166+
endif()
166167
endif()
167168

168169
find_package(OpenCL QUIET)

0 commit comments

Comments
 (0)