From 25b05ebaa9bcc0ebc6599d24d6c486ec32dcbc3f Mon Sep 17 00:00:00 2001 From: Florian Reimold <11774314+FlorianReimold@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:53:31 +0100 Subject: [PATCH] Added support for UDPCAP_LIBRARY_TYPE to control the library type without setting BUILD_SHARED_LIBS (#12) --- README.md | 2 +- udpcap/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c7a8f54..ede237d 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ You can set the following CMake Options to control how Udpcap is supposed to bui | `UDPCAP_THIRDPARTY_USE_BUILTIN_PCAPPLUSPLUS` | `BOOL` | `ON` | Fetch and build against an integrated Version of Pcap++.
_Only available if `UDPCAP_THIRDPARTY_ENABLED=ON`_ | | `UDPCAP_THIRDPARTY_USE_BUILTIN_ASIO` | `BOOL` | `ON` | Fetch and build against an integrated Version of asio.
Only available if `UDPCAP_THIRDPARTY_ENABLED=ON` | | `UDPCAP_THIRDPARTY_USE_BUILTIN_GTEST` | `BOOL` | `ON` | Fetch and build tests against a predefined version of GTest. If disabled, the targets have to be provided externally.
Only available if `UDPCAP_THIRDPARTY_ENABLED=ON` and `UDPCAP_BUILD_TESTS=ON`| -| `BUILD_SHARED_LIBS` | `BOOL` | | Not a udpcap option, but use this to control whether you want to have a static or shared library | +| `UDPCAP_LIBRARY_TYPE` | `STRING` | | Controls the library type of Udpcap by injecting the string into the `add_library` call. Can be set to STATIC / SHARED / OBJECT. If set, this will override the regular `BUILD_SHARED_LIBS` CMake option. If not set, CMake will use the default setting, which is controlled by `BUILD_SHARED_LIBS`. | # How to integrate Udpcap in your project **Integrate as binaries**: diff --git a/udpcap/CMakeLists.txt b/udpcap/CMakeLists.txt index 0e7c07b..0efa589 100644 --- a/udpcap/CMakeLists.txt +++ b/udpcap/CMakeLists.txt @@ -52,7 +52,7 @@ set(sources src/udpcap_socket_private.h ) -add_library (${PROJECT_NAME} +add_library (${PROJECT_NAME} ${UDPCAP_LIBRARY_TYPE} ${includes} ${sources} )