File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ find_path(RDKAFKA_INCLUDE_DIR
77 HINTS ${RDKAFKA_ROOT_DIR} /include
88)
99
10- set (HINT_DIR ${RDKAFKA_ROOT_DIR} /lib)
10+ set (HINT_DIR ${RDKAFKA_ROOT_DIR} /lib)
1111
1212find_library (RDKAFKA_LIBRARY
13- NAMES rdkafka
13+ NAMES rdkafka librdkafka
1414 HINTS ${HINT_DIR}
1515)
1616
@@ -20,11 +20,13 @@ find_package_handle_standard_args(RDKAFKA DEFAULT_MSG
2020 RDKAFKA_INCLUDE_DIR
2121)
2222
23- include (CheckFunctionExists)
23+ set (CONTENTS "#include <librdkafka/rdkafka.h>\n #if RD_KAFKA_VERSION >= 0x00090400\n int main() { }\n #endif" )
24+ set (FILE_NAME ${CMAKE_CURRENT_BINARY_DIR} /rdkafka_version_test.c)
25+ file (WRITE ${FILE_NAME} ${CONTENTS} )
2426
25- set (CMAKE_REQUIRED_LIBRARIES ${RDKAFKA_LIBRARY} )
26- check_function_exists(rd_kafka_offsets_for_times HAVE_VALID_KAFKA_VERSION)
27- set (CMAKE_REQUIRED_LIBRARIES )
27+ try_compile (HAVE_VALID_KAFKA_VERSION ${CMAKE_CURRENT_BINARY_DIR}
28+ SOURCES ${FILE_NAME}
29+ CMAKE_FLAGS "-DINCLUDE_DIRECTORIES= ${RDKAFKA_INCLUDE_DIR} " )
2830
2931if (HAVE_VALID_KAFKA_VERSION)
3032 message (STATUS "Found valid rdkafka version" )
You can’t perform that action at this time.
0 commit comments