Skip to content

Commit

Permalink
plugins/{in,out}_kafka/CMakeLists.txt: fix cross compile error
Browse files Browse the repository at this point in the history
KAFKA_INCLUDEDIR is not set if FLB_PREFER_SYSTEM_LIB_KAFKA is not used,
when cross-compiling, it just translates to -I/librdkafka, which is not allowed.
Fix this by only including KAFKA_INCLUDEDIR if really set.

x86_64-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '-I/librdkafka'

Signed-off-by: Thomas Devoogdt <[email protected]>
  • Loading branch information
ThomasDevoogdt committed Dec 15, 2024
1 parent 362ca1f commit abc06b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion plugins/in_kafka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ set(src
)

FLB_PLUGIN(in_kafka "${src}" ${KAFKA_LIBRARIES})
target_include_directories(flb-plugin-in_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
if(DEFINED KAFKA_INCLUDEDIR)
target_include_directories(flb-plugin-in_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
endif()
target_link_libraries(flb-plugin-in_kafka -lpthread)
4 changes: 3 additions & 1 deletion plugins/out_kafka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ set(src
kafka.c)

FLB_PLUGIN(out_kafka "${src}" ${KAFKA_LIBRARIES})
target_include_directories(flb-plugin-out_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
if(DEFINED KAFKA_INCLUDEDIR)
target_include_directories(flb-plugin-out_kafka PUBLIC ${KAFKA_INCLUDEDIR}/librdkafka)
endif()
target_link_libraries(flb-plugin-out_kafka -lpthread)

0 comments on commit abc06b7

Please sign in to comment.