cmake/AddEventLibrary.cmake


Log

Author Commit Date CI Message
kurtliu 7870e85e 2024-01-24T13:19:23 install DESTINATION use CMAKE_INSTALL_<dir>
Michael Davidsaver c9ec6aaf 2023-08-01T14:02:34 Update cmake policy wrt. RPATH on OSX Previous settings caused install outside CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES to use install_name "lib/" in place of the expected (and useful) "@rpath/".
Azat Khuzhin 2c2ffb8d 2023-05-20T16:00:09 Revert "cmake: Only use relative paths for install DESTINATION option (#1405)" After rebasing I broke the initial intention of this patch, so it simply should be reverted. This reverts commit 81c6b8823c1b58d7837e827bb1098aa5f9e5956b.
Ingo Bauersachs acfac7ae 2022-12-01T18:39:52 Make dependency paths relocatable 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
Jeremy W. Murphy 81c6b882 2023-05-16T05:07:36 cmake: Only use relative paths for install DESTINATION option (#1405) 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>
Jonathan Ringer 1f1593ff 2021-10-27T16:40:10 Use GNUInstallDirs for mapping installation directories
Azat Khuzhin 6d09efe8 2022-01-15T22:06:58 Set RPATH only if installation is done into non system directory v2: use CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES Fixes: #1245
Biswapriyo Nath 1fe8b3d6 2021-05-05T01:26:17 cmake: Fix generted pkgconfig files. Use lowercase 'L' option for library names because uppercase 'L' is used with library search directory.
Loïc Yhuel 657e1806 2020-11-23T17:24:36 cmake: do not link libevent with libevent_core When add_event_library macro was called without the INNER_LIBRARIES parameter, it reused the value set by a previous call, since the INNER_LIBRARIES variable was not reset.
yuangongji ce8be238 2020-01-20T21:17:27 cmake: set rpath for libraries on linux
Azat Khuzhin b9f442e2 2019-11-30T15:53:52 cmake: use CMAKE_LIBRARY_OUTPUT_DIRECTORY for the final shared library symlink Fixes: 669a53f3 ("cmake: set library names to be the same as with autotools")
yuangongji dc4be869 2019-11-07T18:26:47 cmake: improve package config file
yuangongji 5fe83d74 2019-10-25T21:54:13 cmake: eliminate duplicate installation of public headers
Azat Khuzhin 55d1e20e 2019-07-12T00:00:12 cmake: install shared library only if it was requested $ cmake -DEVENT__LIBRARY_TYPE=static .. ... CMake Error: Error evaluating generator expression: $<TARGET_FILE_DIR:event_core_shared> No target "event_core_shared" Fixes: #853 Fixes: 669a53f3 ("cmake: set library names to be the same as with autotools")
yuangongji 669a53f3 2019-07-10T00:30:12 cmake: set library names to be the same as with autotools libtool has VERSION_INFO [1], cmake has SOVERSION/VERSION instead (although it has different format). Also libtool has RELEASE [2] while cmake do not have analog yet [3], hence manual symlinks should be created. [1]: https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html [2]: https://www.gnu.org/software/libtool/manual/html_node/Release-numbers.html [3]: https://gitlab.kitware.com/cmake/cmake/issues/17652 Plus osx has compatibility_version/current_version dylib properties and cmake do not have separate properties for them [4], hence manual LINK_FLAGS. And also there INSTALL_NAME_DIR property which should be adjusted too. [4]: https://public.kitware.com/Bug/view.php?id=4383 So after all changes, here is an example before/after for osx and linux: # osx # autotools .libs/libevent_pthreads-2.2.1.dylib .libs/libevent_pthreads.dylib -> libevent_pthreads-2.2.1.dylib /usr/local/lib/libevent_pthreads-2.2.1.dylib (compatibility version 2.0.0, current version 2.0.0) # cmake # before patch lib/libevent_pthreads.2.2.0.dylib lib/libevent_pthreads.dylib -> libevent_pthreads.2.2.0.dylib @rpath/libevent_pthreads.2.2.0.dylib (compatibility version 2.2.0, current version 0.0.0) # after patch lib/libevent_pthreads-2.2.1.dylib lib/libevent_pthreads.dylib -> libevent_pthreads-2.2.1.dylib /vagrant/.cmake/inst/lib/libevent_pthreads-2.2.1.dylib (compatibility version 2.0.0, current version 2.0.0) # linux # autotools .libs/libevent_pthreads-2.2.so.1 -> libevent_pthreads-2.2.so.1.0.0 .libs/libevent_pthreads-2.2.so.1.0.0 .libs/libevent_pthreads.so -> libevent_pthreads-2.2.so.1.0.0 # cmake # before patch lib/libevent_pthreads.so -> libevent_pthreads.so.2.2.0 lib/libevent_pthreads.so.2.2.0 # after patch lib/libevent_pthreads-2.2.so -> libevent_pthreads-2.2.so.1 lib/libevent_pthreads-2.2.so.1 -> libevent_pthreads-2.2.so.1.0.0 lib/libevent_pthreads-2.2.so.1.0.0 lib/libevent_pthreads.so -> libevent_pthreads-2.2.so.1.0.0 Closes: #838 (cherry-picked) Closes: #760
Azat Khuzhin c9a073ea 2018-11-22T23:00:11 cmake: introduce EVENT__LIBRARY_TYPE option Long time ago in [1] cmake build was forced to compile both libraries (SHARED and STATIC), since this is how our autotools build works. [1]: 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED and STATIC libraries (like autoconf does)") And there is no way to configure this (and indeed you need to do this for MSVC for example), so let's introduce option for this -- EVENT__LIBRARY_TYPE. Plus now we have INTERFACE libraries, that we can use internally in libevent's cmake rules to avoid strict to _shared/_static variant of the libraries to link with samples/tests (we prefer SHARED over STATIC for linking). Also bump minimal cmake required version to 3.1 by the following reasons: - 3.1 is required for RPATH configuration under APPLE - 3.0 is required for add_library(INTERFACE) (did not found it in 2.8.x documentation) - remove extra conditions (anyway 3.1 was release 4 years ago, so I guess that most of the systems will have it)
Philip Herron 0fa43c99 2018-04-05T15:17:06 cmake: ensure windows dll's are installed as well as lib files Closes: #621
Azat Khuzhin b1e8a413 2017-03-14T13:33:31 cmake: use APPEND during exporting targets (for old cmake) On centos with cmake 2.8.12.2: CMake Error at cmake/AddEventLibrary.cmake:92 (export): export called with target "event_extra_shared" which requires target "event_core_shared" that is not in the export list. If the required target is not easy to reference in this call, consider using the APPEND option with multiple separate calls. But on newer cmake I guess everything is ok. Fixes: 7182c2f561570cd9ceb704623ebe9ae3608c7b43 ("cmake: build SHARED and STATIC libraries (like autoconf does)")
Azat Khuzhin 882f537c 2017-03-13T21:40:52 cmake: fix pkgconfig generation (copy-paste typo)
Azat Khuzhin fd5a3fc0 2017-03-13T03:18:02 cmake: fix export absolute path and relative path and cleanup a bit Remove next vars, since I don't think that somebody want to change it: - bin - lib - include And fix exports problem: CMake Error: INSTALL(EXPORT "LibeventTargets") given absolute DESTINATION "/usr/lib/cmake/libevent" but the export references an installation of target "event_core_static" which has relative DESTINATION "lib".
Azat Khuzhin 86c73575 2017-03-13T02:26:39 cmake: generate and install pkgconfig files Fixes: #443
Azat Khuzhin 7182c2f5 2017-03-12T23:31:59 cmake: build SHARED and STATIC libraries (like autoconf does) Since they are useful for debugging, and if autotools build them then cmamke has to do this too, to make migration more simple. And now: - tests: uses shared libraries (since this is upstreams one) - other binaries: uses static libraries This removes next private config: - EVENT__NEED_DLLIMPORT