]> www.ginac.de Git - ginac.git/blob - cmake/modules/FindReadline.cmake
Remove accidentally pushed binary.
[ginac.git] / cmake / modules / FindReadline.cmake
1 # READLINE_FOUND
2 # READLINE_INCLUDE_DIRS
3 # READLINE_LIBRARIES
4
5 if (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
6         set(READLINE_FIND_QUIETLY TRUE)
7 endif()
8
9 include(CheckCXXSourceCompiles)
10
11 find_path(READLINE_INCLUDE_DIRS NAMES readline/readline.h)
12 if (NOT READLINE_INCLUDE_DIRS AND NOT READLINE_FIND_QUIETLY)
13         message(ERROR "couldn't find the readline/readline.h header")
14 endif()
15 find_library(READLINE_LIBRARIES NAMES libreadline readline)
16 if (NOT READLINE_LIBRARIES AND NOT READLINE_FIND_QUIETLY)
17         message(ERROR "couldn't find libreadline")
18 endif()
19
20 if (READLINE_INCLUDE_DIRS AND READLINE_LIBRARIES)
21         set(_save_req_includes ${CMAKE_REQUIRED_INCLUDES})
22         set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${READLINE_INCLUDE_DIR})
23         check_cxx_source_compiles("
24                 #include <stdio.h>
25                 #include <readline/readline.h>
26                 #if !defined(RL_VERSION_MAJOR) || !defined(RL_VERSION_MINOR)
27                 #error Ancient version of readline
28                 #endif
29                 int main() { return 0; }
30                 "
31                 _rl_version_check)
32         set(CMAKE_REQUIRED_INCLUDES ${_save_req_includes})
33         if (NOT _rl_version_check)
34                 set(READLINE_INCLUDE_DIRS READLINE-NOTFOUND)
35                 set(READLINE_LIBRARIES READLINE-NOTFOUND)
36                 if (NOT READLINE_FIND_QUIETLY)
37                         message(ERROR "Ancient/unsupported version of readline")
38                 endif()
39         endif()
40 endif()
41
42 if (NOT READLINE_INCLUDE_DIRS OR NOT READLINE_LIBRARIES)
43         set(READLINE_LIBRARIES READLINE-NOTFOUND)
44         set(READLINE_INCLUDE_DIRS READLINE-NOTFOUND)
45 endif()
46
47 include(FindPackageHandleStandardArgs)
48 FIND_PACKAGE_HANDLE_STANDARD_ARGS(READLINE REQUIRED_VARS READLINE_INCLUDE_DIRS READLINE_LIBRARIES)
49