summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* Make dependency paths relocatableIngo Bauersachs2023-05-161-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generated configurations for both CMake and pkg-config included absolute paths to dependencies (OpenSSL, MbedTLS). This is contrary to the general CMake advise to create relocatable packages [1]. Additionally, when building both mbedtls and libevent via CMake's FetchContent in the same project, loading the project would fail with INTERFACE_INCLUDE_DIRECTORIES property contains path: "/home/user/project/cmake-build/_deps/mbedtls-build/include" which is prefixed in the source directory. The required changes include: - Adding the outer includes only to the BUILD_INTERFACE solves the makes the CMake paths relocatable and thus solves the FetchContent problem. - Updates to libevent_*.pc.in fixes the relocatable issues for pkg-config and properly declares currently missing dependencies. - Using components for linking to OpenSSL (requiring CMake 3.4) and MbedTLS. The new MbedTLS target names now match the component names of the MbedTLS' CMake project. - Use the Threads CMake library reference instead of a direct reference to support both built-in pthread and -lpthread. v2 (azat): get back CMAKE_REQUIRED_LIBRARIES [1] https://cmake.org/cmake/help/v3.25/manual/cmake-packages.7.html#creating-relocatable-packages
* cmake: Only use relative paths for install DESTINATION option (#1405)Jeremy W. Murphy2023-05-151-2/+1
| | | | | | | | | | | | | | | | | As described in #1404, the explicit use of CMAKE_INSTALL_PREFIX conflicts with using command-line --prefix. This simply removes all explicit use of CMAKE_INSTALL_PREFIX. Otherwise this path will be duplicated: $ cmake -DCMAKE_BUILD_TYPE=debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=inst .. $ DESTDIR=inst ninja install ... -- Installing: inst/src/le/libevent/.cmake-debug/inst/include/event2/util.h -- Installing: inst/src/le/libevent/.cmake-debug/inst/include/event2/ws.h ... Fixes: #1404 Co-authored-by: Jeremy Murphy <jeremymu@blackmagicdesign.com>
* Fix Configure_RPATH()Azat Khuzhin2023-05-141-7/+6
|
* Install LibeventConfig.cmake similar to other cmake filesJonathan Ringer2023-05-141-18/+4
| | | | - Don't destroy cmake file between test case invocations
* Use GNUInstallDirs for mapping installation directoriesJonathan Ringer2023-05-141-1/+3
|
* Fix building with -Wstack-protector due to VLA and fobid themAzat Khuzhin2023-04-041-0/+2
| | | | | | | | It is not a thankless task to fix such issues on and on, let's just prohibit this cases, and our build with -Werror on CI will show new issues from now on. Fixes: #1434
* build: split kqueue warning message into cross-compile and applefanquake2023-04-041-2/+7
| | | | | | | This is output when compiling (natively) on macOS systems, which is confusing, because no cross-compilation is involved. Split the message into separate cases.
* build: improve mbedtls searching on macOS with brew for cmake (#1419)Michael Ford2023-03-051-0/+14
| | | This just copies the same logic used to find OpenSSL on macOS using homebrew, for finding mbedtls via brew. Without it, the build will fail out the box with a brew installed mbedtls.
* build: use FORTIFY_SOURCE=3 in CMake buildfanquake2023-02-131-1/+1
|
* Fix pthread detection for regress tests on AndroidAzat Khuzhin2023-01-281-1/+4
| | | | Fixes: #1403
* buffer: use pread() for evbuffer_file_segment_materialize()Dmitry Antipov2023-01-021-0/+1
| | | | | | | If pread(2) is available, prefer it over double lseek(2) and read(2) in evbuffer_file_segment_materialize(). Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
* Allow CLI override of CMAKE_DEBUG_POSTFIX (#1391)mdavidsaver2022-12-161-1/+3
| | | Allows cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_DEBUG_POSTFIX= for a debug build with the regular library names.
* cmake: remove redundant _GNU_SOURCE definitionAzat Khuzhin2022-11-201-1/+0
| | | | | | | | | As reported by @francoisk: `_GNU_SOURCE` is defined in the private config header but also on the compiler command-line for every object. Fixes: #1333
* cmake: do influence CMAKE_DEBUG_POSTFIX of the outer project (if any)Azat Khuzhin2022-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | Consider the following example: $ touch lib.c $ cat > CMakeLists.txt <<EOL add_subdirectory(/src/le/libevent libevent EXCLUDE_FROM_ALL) add_library(lib lib.c) EOL $ mkdir .cmake $ cmake -DCMAKE_BUILD_TYPE=debug -G Ninja .. $ ninja $ ls *.a liblibd.a So now outer project also has "d" prefix for libraries. Let's avoid this by setting non-cached variable. Fixes: #1371
* signal: new signal handling backend based on signalfdDmitry Antipov2022-11-121-0/+6
| | | | | | | | Linux-specific signal handling backend based on signalfd(2) system call, and public function event_base_get_signal_method() to obtain an underlying kernel signal handling mechanism. Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
* Ignore unknown pragmasAzat Khuzhin2022-11-121-0/+2
| | | | | | Since new compilers has new checks (like -Wdangling-pointer), and so to avoid extra checks in cmake/autotools, simply suppress if the pragma is unknown.
* cmake: tiny cleanupAzat Khuzhin2022-11-121-6/+4
|
* cmake: Fix Android build.Ryan Pavlik2022-10-081-0/+5
| | | | | Android/Bionic C library needs no special flags to have threading support. Found when trying to build with vcpkg.
* epoll: use epoll_pwait2() if availableDmitry Antipov2022-09-271-0/+1
| | | | | On GNU/Linux with epoll backend, prefer epoll_pwait2() if available, which is useful to support the timeout with microsecond precision.
* Add manual CMAKE_C_BYTE_ORDER set for old CMakeDmitry Ilyin2022-09-261-0/+9
|
* Add minimal WebSocket server implementation for evhttp (#1322)Dmitry Ilyin2022-09-121-0/+10
| | | | | | | | | | | | | | This adds few functions to use evhttp-based webserver to handle incoming WebSockets connections. We've tried to use both libevent and libwebsockets in our application, but found that we need to have different ports at the same time to handle standard HTTP and WebSockets traffic. This change can help to stick only with libevent library. Implementation was inspired by modified Libevent source code in ipush project [1]. [1]: https://github.com/sqfasd/ipush/tree/master/deps/libevent-2.0.21-stable Also, WebSocket-based chat server was added as a sample.
* Add openssl-compat.h into HDR_PRIVATEAzat Khuzhin2022-09-111-0/+1
| | | | Fixes: #1334
* Fixed CMake configuration failure (libevent#1321)Borys Smejda2022-08-131-1/+1
| | | | | | | | Deleted usage of CMake feature 'file(REAL_PATH' which is available from version 3.19 with an old 'get_filename_component' so that older version of CMake can still be used to configure the project.
* Add check of mmap64 function and use it when available rather that mmapDmitry Ilyin2022-08-091-0/+1
| | | | | | There can be issues on 32-bit architectures to mmap 2+GiB file, and to make this portable between different version of glibc, mmap64 was prefered over _FILE_OFFSET_BITS
* Add postfix for Debug configuration.Haowei Hsu2022-08-071-0/+2
|
* Detech -Wno-unused-functions for GCC tooAzat Khuzhin2022-07-091-1/+3
| | | | | | | | | | | | | | | | | Otherwise build fails [1]: /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/minheap-internal.h:64:6: error: ‘min_heap_ctor_’ defined but not used [-Werror=unused-function] void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; } ^~~~~~~~~~~~~~ In file included from /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/buffer.c:91:0: /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/bufferevent-internal.h:414:1: error: ‘bufferevent_trigger_nolock_’ defined but not used [-Werror=unused-function] bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/buffer.c:89:0: /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/evthread-internal.h:140:1: error: ‘EVLOCK_TRY_LOCK_’ defined but not used [-Werror=unused-function] EVLOCK_TRY_LOCK_(void *lock) [1]: https://github.com/libevent/libevent/runs/7263518180?check_suite_focus=true
* cmake: add compiler version to the status messageAzat Khuzhin2022-07-091-1/+1
|
* Add -Wundef for cmake and fix EVENT__SIZEOF_TIME_T usageAzat Khuzhin2022-07-091-0/+1
| | | | Note, autotools already supports it.
* build: only try silence options if they existfanquake2022-06-301-4/+4
| | | | | | | | | | Otherwise GCC will warn. i.e: ```bash CCLD libevent_openssl.la cc1: note: unrecognized command-line option ‘-Wno-void-pointer-to-enum-cast’ may have been intended to silence earlier diagnostics CCLD libevent_mbedtls.la ```
* Do not install RPATH for install tree by defaultAzat Khuzhin2022-03-101-0/+1
| | | | | | | | | | | | | In ce8be2385b5fee16859a630fca0c98ad290c8e21 ("cmake: set rpath for libraries on linux") RPATH was first instroduced. Later in 6d09efe8686de824adf3d8810bbe0d5c386643e4 ("Set RPATH only if installation is done into non system directory") it was set only if it was installed to non system directory. But absolute RPATH not a good default, let's change this. Fixes: #920
* Set RPATH only if installation is done into non system directoryAzat Khuzhin2022-01-151-0/+20
| | | | | | v2: use CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES Fixes: #1245
* Add -Wno-void-pointer-to-enum-cast (we use this hack in tests)Azat Khuzhin2021-09-191-0/+3
| | | | Refs: https://reviews.llvm.org/D75758
* cmake: don't override CMAKE_CONFIGURATION_TYPES.Paweł Wegner2021-05-141-4/+0
| | | | Surprisingly this overrides configuration types for projects which embed libevent using cmake's add_subdirectory.
* build: remove no-longer used checks for vasprintffanquake2021-03-281-2/+0
| | | | | From what I can tell the last usage was removed in 8d1317d71c46e27c5073d3429a64af69de0351a6.
* build: remove splice implementation fragmentsfanquake2021-03-281-1/+0
| | | | | | | Looks like a `splice` implementation was planned, but has clearly never eventuated (the TODO comment is from ~12 years ago, in 8b5bd77415fb6634fadf08357676926fecf5f032). For now, it's probably better to remove the unused code/correct the docs.
* cmake: find openssl prefix via brewAzat Khuzhin2020-11-021-0/+19
|
* sample: add https-client-mbedtlsokhowang(王沛文)2020-09-161-0/+3
|
* build: fix building under windows with thread supportAzat Khuzhin2020-09-011-1/+1
| | | | Fixes: 972289f3 ("Detect existence of pthread_mutexattr_setprotocol()")
* Detect existence of pthread_mutexattr_setprotocol()Azat Khuzhin2020-08-291-31/+42
| | | | Fixes: #1084
* Convert from WinCrypt to Windows BCryptGerry Garvey2020-08-021-2/+2
| | | | Fixes: #1069
* Merge ssl implementations (openssl and mbedtls)okhowang(王沛文)2020-07-221-2/+2
| | | | | | | | This patch splits common part out to avoid copy-paste from the - bufferevent_openssl.c - bufferevent_mbedtls.c It uses VFS/bufferevent-like approach, i.e. structure of callbacks.
* fix build system and add test and cleanup codeokhowang(王沛文)2020-07-221-7/+21
|
* mbed TLS cmake supportJesse Fang2020-07-221-0/+24
| | | | | | | | FindMbedTLS.cmake is come from https://github.com/AVSystem/avs_commons/blob/master/cmake/FindMbedTLS.cmake, which is licensed under Apache 2.0 alternatives: https://github.com/curl/curl/blob/master/CMake/FindMbedTLS.cmake without variable MBEDTLS_ROOT_DIR https://github.com/libgit2/libgit2/blob/master/cmake/Modules/FindmbedTLS.cmake GPLv2 with a special Linking Exception
* build: do not disable deprecation warnings on macOSPierce Lopez2020-07-041-2/+1
| | | | | this was for using openssl-0.9.8 included in macOS 10.7 - 10.12, but it is long since time you really should not use that openssl
* cmake: avoid problems from use of CMAKE_USE_PTHREADS_INITPaul Osborne2020-06-181-2/+2
| | | | | | | | | | | | | In some CMake integrations, portions of the toolchain may end up defining CMAKE_USE_PTHREADS_INIT even when EVENT__DISABLE_THREAD_SUPPORT is set for libevent. Modify the build to not rely on this side effect of find_package(Threads, ...) [which could be done elsewhere] but instead to use EVENT__HAVE_PTHREADS which is defined only on the desired codepath. Without this change, affected builds fail as a result of event_pthreads source files being built but with build defines which cause the build to fail. Signed-off-by: Paul Osborne <paul.osborne@smartthings.com>
* Add wepoll support to light up the epoll backend on WindowsNick Grifka2020-05-081-3/+15
| | | | | | | | | | | | | | | | | | | | | | libevent is lacking a scalable backend on Windows. Let's leverage the wepoll library until Windows comes up with an epoll/kqueue compete user mode API. - All regress tests pass for standard wepoll - These 2 tests fail intermittently for changelist wepoll, so disabling changelist wepoll for now http/cancel_inactive_server http/stream_in - verify target on Windows runs tests for both wepoll and win32 backends - wepoll backend preferred over win32 backend - wepoll version 1.5.6 v2: cleaner backend abstraction. Disallow wepoll on MinGW/Cygwin. v3: Add wepoll.h to dist v4: Make sure wepoll source files are excluded from cygwin/mingw builds v5: Keep win32 as default backend on windows. v6: Include wepoll in mingw builds. Verified that regress tests pass w/ WEPOLL backend. v7: Enable wepoll on mingw when building with cmake v8: Add wepoll testrunner for autotools test target
* Pass --quiet to the event_rcpgen.py (autotools already does this)Azat Khuzhin2020-05-051-1/+1
|
* cmake: missing test-closed binaryAzat Khuzhin2020-04-081-0/+1
|
* cmake: replace CheckFunctionExists with CheckSymbolExistsyuangongji2020-03-221-150/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Checking functions with `CheckFunctionExists` may get wrong results, we should replace it with `CheckSymbolExists`, which is recommended by the cmake official documentation. Before using `CheckSymbolExists`, we use `CheckIncludeFiles` to check header files and save the available header files in a variable that guarantees `CheckSymbolExists` and `CheckTypeSize` to work correctly. This approach is modeled after the cmake scripts of `curl`. The following functions or files were not found before modification, they can now be found: - msys2 + mingw-8.1.0 on Windows10 or mingw-7.3.0 on Ubuntu-18.04 timerclear timercmp timerisset - windows10 getaddrinfo getnameinfo getprotobynumber getservbyname putenv strtoll timerclear timercmp timerisset - ubuntu-18.04 sys/sysctl.h timeradd timerclear timercmp timerisset - MacOS 10.13 sys/random.h timeradd timerclear timercmp timerisset
* cmake: fix getaddrinfo checking erroryuangongji2020-03-171-12/+20
| | | | | | | Using `CheckFunctionExists` on Windows to check `getaddrinfo` will get `not found`, but it actually exists. Using `CheckSymbolExists` with headers will get correct results. Other functions such as `getnameinfo`,`inet_ntop`,etc. have the same issue.