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.
When building for X86 the CMake check_library_exists always fails to find
functions from the Win32 API due to name mangling conventions. The convention
for API functions is __stdcall and the CMake test code assumes __cdecl. Since
these are libraries from the Windows API we can simply link against the
libraries without checking for the functions.
Since libuv.pc is broken at the moment, try to determine libuv's
dependencies ourselves. This ports most of the checks from libuv into
our CMake build, and fixes the build on other unix platforms.
This achieves several goals:
* Less reliance on scripts so we have better portability to Windows
(though we still have a ways to go for proper Windows support).
Luajit, luarocks, moonscript, and busted are all installed via CMake
now.
* Trying to make use of pkg-config to get the correct libraries. The
latest libuv is still broken in this regard, but we'll at least be in
a position to use it.
* Allow the use of Ninja or make. The former runs faster in many
environments, and automatically makes use of parallel builds.
This also allows for system installed dependencies--though not through
the Makefile just yet--and adds support for FreeBSD.
This also make us build libuv and luajit as static libraries only, since
we're only concerned about having static libraries for our bundled
dependencies.
If LibUV_USE_STATIC is set then the static libuv library will be
preferred to the shared library. This is useful when building with the
bundled libuv but is less useful when building with a system libuv.
Explicitly try to find the static libuv library first.
This might be considered a hack and if it weren't a single-use module it
might be preferable to control static versus shared preferences with a
configuration variable.