On my x86_64 Gentoo Linux, the CMake build won't find libevent because
Gentoo wraps include files via multilib-aware wrappers. This means that
the "real" include file lives in
/usr/include/x86_64-pc-linux-gnu/event2/event-config.h , and that
there's a proxy file at /usr/include/event2/event-config.h which check
the compile target's architecture and includes the real file from a
correct directory.
In other words, nghttp2's CMake FindLibevent.cmake reads a wrong file
and ends up not detecting the libevent's version.
This patch fixes it by simply using the version reported by pkg-config
as the libevent's version if the original method fails. I will be happy
to change this patch to always check version from pkg-config if you're
OK with that.
Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
The name passed to find_package should match the one that is passed to
find_package_handle_standard_args, otherwise the version matching is not
properly done. The names are based on the FindXXX.cmake filename.
This also simplifies components reporting for Libevent (done by
find_package_handle_standard_args) and results in reporting a library
instead of include directory when found.
Add auto-detection to the most important features (app, hpack, etc.).
Move options to a separate file for easier search.
Add cmake-based Libevent, jansson and CUnit search. Move pkg-config
handling for Libev and jemalloc to their cmake files.
Note: duplicates find_package before including CMakeOptions.txt and when
checking for features. Maybe that can be cleaned up later...