1# BAREOS® - Backup Archiving REcovery Open Sourced 2# 3# Copyright (C) 2017-2019 Bareos GmbH & Co. KG 4# 5# This program is Free Software; you can redistribute it and/or 6# modify it under the terms of version three of the GNU Affero General Public 7# License as published by the Free Software Foundation and included 8# in the file LICENSE. 9# 10# This program is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Affero General Public License for more details. 14# 15# You should have received a copy of the GNU Affero General Public License 16# along with this program; if not, write to the Free Software 17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18# 02110-1301, USA. 19 20# Search for the path containing library's headers 21find_path(Readline_ROOT_DIR NAMES include/readline/readline.h) 22 23# Search for include directory 24find_path( 25 Readline_INCLUDE_DIR 26 NAMES readline/readline.h 27 HINTS ${Readline_ROOT_DIR}/include 28) 29 30# Search for library 31if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 32 set(Readline_LIBRARY /usr/local/opt/readline/lib/libreadline.a ncurses) 33else() 34 find_library( 35 Readline_LIBRARY 36 NAMES readline 37 HINTS ${Readline_ROOT_DIR}/lib 38 ) 39endif() 40# Conditionally set READLINE_FOUND value 41if(Readline_INCLUDE_DIR 42 AND Readline_LIBRARY 43 AND Ncurses_LIBRARY 44) 45 set(READLINE_FOUND TRUE) 46else( 47 Readline_INCLUDE_DIR 48 AND Readline_LIBRARY 49 AND Ncurses_LIBRARY 50) 51 find_library(Readline_LIBRARY NAMES readline) 52 include(FindPackageHandleStandardArgs) 53 find_package_handle_standard_args( 54 Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY 55 ) 56 mark_as_advanced(Readline_INCLUDE_DIR Readline_LIBRARY) 57endif( 58 Readline_INCLUDE_DIR 59 AND Readline_LIBRARY 60 AND Ncurses_LIBRARY 61) 62 63# Hide these variables in cmake GUIs 64mark_as_advanced(Readline_ROOT_DIR Readline_INCLUDE_DIR Readline_LIBRARY) 65