For unified builds, LLVM with the update to stable/20221013 includes its
own FindLibEdit, which shares many of the same names than Swift's
FindLibEdit, except that they differ in the target name.
Match both LLVM and Swift target names, so unified builds can find
LibEdit::LibEdit correctly and not try to link against libedit
mistakenly.
This should not affect Darwin/Linux builds from upstream Swift, since
they build non-unified in most people setups (including CI).
The current FOUND_VAR for FindLibEdit is libedit_FOUND but wasn't set by
find_package_handle_standard_args. However this isn't valid for the
package name.
The argument for FOUND_VAR is "libedit_FOUND", but only
"LibEdit_FOUND" and "LIBEDIT_FOUND" are valid names.
This fixes all the variables set by FindLibEdit to match the desired
naming scheme.
Thanks to Jonas for fixing the variable names!
Use the FindLibEdit.cmake module from LLDB to properly control where
the libedit libraries are searched for and linked from as well as where
the headers come from. This uses the standard mechanisms which allows
users to control where libedit is pulled from (which is important for
cross-compilation).
This second version is more aggressive about pruning the libedit
handling. The Ubuntu 14.04 version of libedit does not have
`histedit.h`, and the intent is to rely on that to determine if we have
unicode support or not.
Use the `FindLibEdit.cmake` module from LLDB to properly control where
the libedit libraries are searched for and linked from as well as where
the headers come from. This uses the standard mechanisms which allows
users to control where libedit is pulled from (which is important for
cross-compilation).