@@ -46,7 +46,7 @@ string(REGEX REPLACE "^([^.]*)\\..*" "\\1" VERSION_MAJOR ${VERSION_PLAIN})
46
46
string (REGEX REPLACE "^[^.]*\\ .([^.]*)\\ ..*" "\\ 1" VERSION_MINOR ${VERSION_PLAIN} )
47
47
string (REGEX REPLACE "^[^.]*\\ .[^.]*\\ .([0-9]*).*" "\\ 1" VERSION_PATCH ${VERSION_PLAIN} )
48
48
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
50
50
OUTPUT_VARIABLE GIT_REV)
51
51
string (REGEX REPLACE "\n $" "" PACKAGE_VERSION "${GIT_REV} " )
52
52
endif ()
@@ -142,27 +142,28 @@ endif()
142
142
#
143
143
###############################################################################
144
144
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)
160
146
if (STATIC )
161
147
set (CPPAN_BUILD_SHARED_LIBS 0)
162
148
else ()
163
149
set (CPPAN_BUILD_SHARED_LIBS 1)
164
150
endif ()
165
151
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 ()
166
167
endif ()
167
168
168
169
find_package (OpenCL QUIET )
0 commit comments