Line 0
Link Here
|
|
|
1 |
# |
2 |
# Find Leptonica |
3 |
# |
4 |
# Exported variables: |
5 |
# Leptonica_FOUND |
6 |
# Leptonica_INCLUDE_DIRS |
7 |
# Leptonica_LIBRARIES |
8 |
# |
9 |
# Leptonica_VERSION |
10 |
# Leptonica_MAJOR_VERSION |
11 |
# Leptonica_MINOR_VERSION |
12 |
# |
13 |
|
14 |
find_path(Leptonica_INCLUDE_DIR leptonica/allheaders.h |
15 |
HINTS |
16 |
/usr/include |
17 |
/usr/local/include |
18 |
/opt/include |
19 |
/opt/local/include |
20 |
${Leptonica_DIR}/include |
21 |
) |
22 |
if(NOT "${Leptonica_INCLUDE_DIR}" EQUAL "Leptonica_INCLUDE_DIR-NOTFOUND") |
23 |
set(Leptonica_INCLUDE_DIRS ${Leptonica_INCLUDE_DIR}/leptonica) |
24 |
file(STRINGS ${Leptonica_INCLUDE_DIRS}/allheaders.h Leptonica_MAJOR_VERSION REGEX "LIBLEPT_MAJOR_VERSION") |
25 |
file(STRINGS ${Leptonica_INCLUDE_DIRS}/allheaders.h Leptonica_MINOR_VERSION REGEX "LIBLEPT_MINOR_VERSION") |
26 |
string(REGEX MATCH "[0-9]+" Leptonica_MAJOR_VERSION ${Leptonica_MAJOR_VERSION}) |
27 |
string(REGEX MATCH "[0-9]+" Leptonica_MINOR_VERSION ${Leptonica_MINOR_VERSION}) |
28 |
set(Leptonica_VERSION ${Leptonica_MAJOR_VERSION}.${Leptonica_MINOR_VERSION}) |
29 |
endif() |
30 |
|
31 |
find_library(Leptonica_LIBRARY NAMES lept liblept |
32 |
HINTS |
33 |
/usr/lib |
34 |
/usr/local/lib |
35 |
/opt/lib |
36 |
/opt/local/lib |
37 |
${Leptonica_DIR}/lib |
38 |
) |
39 |
set(Leptonica_LIBRARIES ${Leptonica_LIBRARY}) |
40 |
|
41 |
include(FindPackageHandleStandardArgs) |
42 |
|
43 |
find_package_handle_standard_args(Leptonica |
44 |
REQUIRED_VARS |
45 |
Leptonica_INCLUDE_DIRS |
46 |
Leptonica_LIBRARIES |
47 |
VERSION_VAR Leptonica_VERSION |
48 |
FAIL_MESSAGE "Try to set Leptonica_DIR or Leptonica_ROOT" |
49 |
) |
50 |
|
51 |
mark_as_advanced(Leptonica_INCLUDE_DIRS Leptonica_LIBRARIES) |
52 |
|