At least in OpenBSD, there is a libedit library in base, but without
public headers. Public headers for readline are available but since
15db5d36 (pcre2test: avoid using readline headers with libedit,
2022-04-07) won't be picked up automatically.
Allow pointing cmake to those headers by doing (for example):
$ cmake -DEDITLINE_INCLUDE_DIR=/usr/include/readline
Or using custom CPPFLAGS with configure (for example):
$ CPPFLAGS=-I/usr/include/readline ./configure --enable-pcre2test-libedit
Since the headers from readline.h would be otherwise incomplete, detect
that case and pull the extra headers that are required automagically and
while at it, cleanup the NCURSES dependency that was unnecessarily copied
from readline.