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 Nov 16, 2024
1 parent ec64fb4 commit b398800
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 b398800

Please sign in to comment.