From 70f65eafd8c13d300fc096dafcecf47c11d67e4d Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Fri, 10 Nov 2023 15:57:11 -0300 Subject: [PATCH] cmake: link missing framework CoreFoundation and IOKit for machine_id on macOS. Signed-off-by: Phillip Whelan --- src/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6233d9f721..e07db1cd1c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -554,6 +554,22 @@ if(FLB_BINARY) DESTINATION ${FLB_INSTALL_CONFDIR} COMPONENT binary RENAME "${FLB_OUT_NAME}.conf") + + # link in CoreFoundation and IOKit for machine_id code on macOS + find_library(CORE_FOUNDATION CoreFoundation) + if (NOT CORE_FOUNDATION) + message(FATAL_ERROR "CoreFoundation framework missing on macOS") + endif() + + find_library(IOKITLIB IOKit) + if (NOT IOKITLIB) + message(FATAL_ERROR "IOKitLib framework missing on macOS") + endif() + + target_link_libraries(fluent-bit-static "-framework CoreFoundation") + target_link_libraries(fluent-bit-static "-framework IOKit") + set_target_properties(fluent-bit-static PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks") + else() install(FILES "${PROJECT_SOURCE_DIR}/conf/fluent-bit.conf"