diff options
author | Jo-Philipp Wich <jo@mein.io> | 2023-10-10 16:06:56 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2023-10-10 16:26:08 +0200 |
commit | 8f21cfa9571e8fc3518ede92356d97e09f4713de (patch) | |
tree | d4a3d922dd05c2b4997bcd2f6681d08f4faac4a1 /CMakeLists.txt | |
parent | 8a3aefee5df1d37ff36c00a89847e04c13a235bd (diff) |
lib: introduce log library
Introduce a new `log` library which provides bindings for syslog and,
if available, the OpenWrt libubox ulog functions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d131698..ce907dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ option(NL80211_SUPPORT "Wireless Netlink plugin support" ${DEFAULT_NL_SUPPORT}) option(RESOLV_SUPPORT "NS resolve plugin support" ON) option(STRUCT_SUPPORT "Struct plugin support" ON) option(ULOOP_SUPPORT "Uloop plugin support" ${DEFAULT_ULOOP_SUPPORT}) +option(LOG_SUPPORT "Log plugin support" ON) set(LIB_SEARCH_PATH "${CMAKE_INSTALL_PREFIX}/lib/ucode/*.so:${CMAKE_INSTALL_PREFIX}/share/ucode/*.uc:./*.so:./*.uc" CACHE STRING "Default library search path") string(REPLACE ":" "\", \"" LIB_SEARCH_DEFINE "${LIB_SEARCH_PATH}") @@ -239,6 +240,19 @@ if(ULOOP_SUPPORT) target_link_libraries(uloop_lib ${libubox}) endif() +if(LOG_SUPPORT) + set(LIBRARIES ${LIBRARIES} log_lib) + add_library(log_lib MODULE lib/log.c) + set_target_properties(log_lib PROPERTIES OUTPUT_NAME log PREFIX "") + target_link_options(log_lib PRIVATE ${UCODE_MODULE_LINK_OPTIONS}) + if(libubox) + find_path(ulog_include_dir NAMES libubox/ulog.h) + include_directories(${ulog_include_dir}) + target_link_libraries(log_lib ${libubox}) + set_target_properties(log_lib PROPERTIES COMPILE_DEFINITIONS HAVE_ULOG) + endif() +endif() + if(UNIT_TESTING) enable_testing() add_definitions(-DUNIT_TESTING) |