2014-08-30 17:41:23 +02:00
|
|
|
# Modified from FindReadline.cmake (PH Feb 2012)
|
|
|
|
|
2022-04-14 17:51:51 +02:00
|
|
|
if(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY)
|
2014-08-30 17:41:23 +02:00
|
|
|
set(EDITLINE_FOUND TRUE)
|
2022-04-14 17:51:51 +02:00
|
|
|
else(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY)
|
pcre2test: really allow using libedit when enabled (#96)
* pcre2test: use the right header for libedit in FreeBSD with autoconf
When `./configure --enable-pcre2test-libedit` is used in FreeBSD,
the resulting test will succeed but won't set the necessary flag
to distinguish between libedit and readline header files, therefore
using readline's at built time (if installed)
Consolidate all header tests into one and use instead the corresponding
autogenerated defines to check for each possibility.
* pcre2test: really allow libedit with cmake
Using cmake to configure and enable linking pcre2test with libedit,
could result in a broken build, because the header used was instead
pointing to readline.
In cases were the build will succeed (because both libraries were
available), it would likely show warnings, because several history
functions were being used without declarations, since readline
requires including "history.h" for those.
Additionally, since PCRE2_SUPPORT_READLINE is ON by default (unlike
configure), turning PCRE2_SUPPORT_LIBEDIT=ON, would require setting
that other option to OFF explicitly (even if readline wasn't available)
or the setup would abort.
Lastly, in systems with no default sysroot (ex: macOS), the use of
absolute paths for searching for libedit's readline.h could fail so
use instead relative PATH_SUFFIXES.
* pcre2test: avoid using readline headers with libedit
When asked to enable libedit in a system that ALSO has readline,
the headers of the former would be found and used by the earlier.
While that would mostly work, some functions will be missing
definitions (which is forbidden in C99), so instead abort the
configuration and let the user provide for them.
2022-04-08 18:07:30 +02:00
|
|
|
FIND_PATH(EDITLINE_INCLUDE_DIR readline.h PATH_SUFFIXES
|
|
|
|
editline
|
|
|
|
edit/readline
|
2014-08-30 17:41:23 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
FIND_LIBRARY(EDITLINE_LIBRARY NAMES edit)
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2022-04-14 17:51:51 +02:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Editline DEFAULT_MSG EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
|
2014-08-30 17:41:23 +02:00
|
|
|
|
|
|
|
MARK_AS_ADVANCED(EDITLINE_INCLUDE_DIR EDITLINE_LIBRARY)
|
2022-04-14 17:51:51 +02:00
|
|
|
endif(EDITLINE_INCLUDE_DIR AND EDITLINE_LIBRARY)
|