- Remove unused code
- Use consistent casing. Variable names such as LibLuV_LIBRARIES is
needlessly jarring, even if the name might be technically correct.
- Use title casing for packages. find_package(unibilium) requires the
find_module to be named "Findunibilium.cmake", which makes it harder
to spot when scanning the files. Instead, use "Unibilium".
We are using "LIBFOO" prefixes for `LIBFOO_INCLUDE_DIRS` etc, and
therefore need to use this for the PREFIX with LibFindMacros also, so
that `"${${PREFIX}_FIND_VERSION}"` gets handled there properly.
The alternative would be to either manually handle/set the upper/mixed case
variants of those variable additionally, which is not as easy.
Keeping the existing names is useful for packagers.
Before this the version requirements with
`find_package(Unibilium 2.0 REQUIRED)` was not handled (a49cf5126), and
it prepares for using a required version with libvterm
(initially/wrongly ported in 1896c72a5).
* build: require unibilium>=2.0
This also ports FindUnibilium to LibFindMacros, which was planned
anyway, and makes the version check easier.
With an older Unibilium our fallback code in `terminfo_from_builtin`
will not work (because it assumes the new data structures from 2.0.0 [1]),
and nvim would crash later because of `ut` being NUL.
1: 42f3cdd284
The variables are not meant to be defined there really, but only with
the third-party project.
Using them, e.g. with the following, would actually result in libvterm
not being found then:
make CMAKE_EXTRA_FLAGS="-DUSE_BUNDLED_LIBVTERM=ON" \
DEPS_CMAKE_FLAGS="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBVTERM=ON"
In https://github.com/neovim/neovim/pull/6357 they were renamed to
`USE_BUNDLED_X` from `X_USE_BUNDLED`, but the above reasoning applies
to the old names, too.
Internally `CMAKE_PREFIX_PATH` is used to add the built/bundled third
party packages for `find_package`, so there is no reason to e.g. query
the values via `load_cache` for example from the third-party project.
The package argument is case sensitive, which is important to handle
X_FIND_REQUIRED properly, i.e. error out early if it is not found:
CMake Error at /usr/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Unibilium (missing: UNIBILIUM_LIBRARY UNIBILIUM_INCLUDE_DIR)
Otherwise it would continue until:
CMake Error: The following variables are used in this project, but they
are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the
CMake files:
UNIBILIUM_INCLUDE_DIR (ADVANCED)
Quickly checked via `rg 'find_package_handle_standard|find_package.*REQUIRED' -I | sort`.
Ref: https://gitlab.kitware.com/cmake/cmake/issues/19413