CMakeLists.txt: use pkg-config to find readline

Use pkg_check_modules to find readline dependencies such as ncurses and
fallback on current mechanism.

This will fix the following build failure when building statically:

/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libreadline.a(display.o): in function `cr':
display.c:(.text+0x1a0): undefined reference to `tputs'

Fixes:
 - http://autobuild.buildroot.org/results/88609eefe55af2ca50d43e17d3424b923528b07a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
This commit is contained in:
Fabrice Fontaine 2020-01-10 08:49:51 +01:00
parent 9b069faf87
commit c538c9fa7e

View file

@ -629,12 +629,15 @@ endif ( enable-oboe )
unset ( WITH_READLINE CACHE )
unset ( READLINE_LIBS CACHE )
if ( enable-readline )
find_package ( Readline )
set ( FOUND_READLINE ${HAVE_READLINE} )
if ( HAVE_READLINE )
pkg_check_modules ( READLINE readline )
if ( NOT READLINE_FOUND )
find_package ( Readline )
set ( READLINE_FOUND ${HAVE_READLINE} )
endif ( NOT READLINE_FOUND )
if ( READLINE_FOUND )
set ( WITH_READLINE 1 )
set ( READLINE_LIBS ${READLINE_LIBRARIES} )
endif ( HAVE_READLINE )
endif ( READLINE_FOUND )
endif ( enable-readline )
unset ( ENABLE_MIXER_THREADS CACHE )