| 1 |
# - Try to find readline include dirs and libraries |
| 2 |
# |
| 3 |
# Usage of this module as follows: |
| 4 |
# |
| 5 |
# find_package(Readline) |
| 6 |
# |
| 7 |
# Variables used by this module, they can change the default behaviour and need |
| 8 |
# to be set before calling find_package: |
| 9 |
# |
| 10 |
# Readline_ROOT_DIR Set this variable to the root installation of |
| 11 |
# readline if the module has problems finding the |
| 12 |
# proper installation path. |
| 13 |
# |
| 14 |
# Variables defined by this module: |
| 15 |
# |
| 16 |
# READLINE_FOUND System has readline, include and lib dirs found |
| 17 |
# Readline_INCLUDE_DIR The readline include directories. |
| 18 |
# Readline_LIBRARY The readline library. |
| 19 |
|
| 20 |
find_path(Readline_ROOT_DIR |
| 21 |
NAMES include/readline/readline.h includes/editline/readline.h |
| 22 |
develop/headers/x86/readline/readline.h develop/headers/x86/editline/readline.h |
| 23 |
develop/headers/readline/readline.h develop/headers/editline/readline.h |
| 24 |
) |
| 25 |
|
| 26 |
find_path(Readline_INCLUDE_DIR |
| 27 |
NAMES readline.h |
| 28 |
HINTS ${Readline_ROOT_DIR}/include/readline ${Readline_ROOT_DIR}/develop/headers/x86/readline |
| 29 |
${Readline_ROOT_DIR}/develop/headers/readline |
| 30 |
${Readline_ROOT_DIR}/include/editline ${Readline_ROOT_DIR}/develop/headers/x86/editline |
| 31 |
${Readline_ROOT_DIR}/develop/headers/editline |
| 32 |
) |
| 33 |
|
| 34 |
if(EXISTS ${Readline_INCLUDE_DIR}/history.h) |
| 35 |
add_definitions(-DHAVE_READLINE_HISTORY_H=1) |
| 36 |
endif() |
| 37 |
|
| 38 |
find_library(Readline_LIBRARY |
| 39 |
NAMES readline edit |
| 40 |
HINTS ${Readline_ROOT_DIR}/lib ${Readline_ROOT_DIR}/develop/lib/x86 |
| 41 |
${Readline_ROOT_DIR}/develop/lib |
| 42 |
) |
| 43 |
|
| 44 |
if(Readline_INCLUDE_DIR AND Readline_LIBRARY) |
| 45 |
set(READLINE_FOUND TRUE) |
| 46 |
else(Readline_INCLUDE_DIR AND Readline_LIBRARY) |
| 47 |
FIND_LIBRARY(Readline_LIBRARY NAMES readline edit) |
| 48 |
include(FindPackageHandleStandardArgs) |
| 49 |
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY ) |
| 50 |
MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY) |
| 51 |
endif(Readline_INCLUDE_DIR AND Readline_LIBRARY) |
| 52 |
|
| 53 |
mark_as_advanced( |
| 54 |
Readline_ROOT_DIR |
| 55 |
Readline_INCLUDE_DIR |
| 56 |
Readline_LIBRARY |
| 57 |
) |