Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only use static Avro library
As the dynamic library is not available in most repositories, the static
one should be used.
  • Loading branch information
markus456 committed May 8, 2018
1 parent 55155e9 commit 8a68c40
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions cmake/FindAvro.cmake
@@ -0,0 +1,14 @@
# This CMake file locates the libavro.a static library and the avro.h header
#
# The following variables are set:
# AVRO_FOUND - If the Avro C library was found
# AVRO_LIBRARIES - Path to the static library
# AVRO_INCLUDE_DIR - Path to Avro headers

find_path(AVRO_INCLUDE_DIRS avro.h)
find_library(AVRO_LIBRARIES libavro.a)

if (AVRO_INCLUDE_DIRS AND AVRO_LIBRARIES)
message(STATUS "Found Avro C libraries: ${AVRO_LIBRARIES}")
set(AVRO_FOUND TRUE)
endif()
6 changes: 6 additions & 0 deletions kafka-avro-adapter/CMakeLists.txt
Expand Up @@ -36,6 +36,12 @@ if (NOT RDKAFKAPP_FOUND)
endif()
include_directories(${RDKAFKAPP_INCLUDE_DIRS})

find_package(Avro)
if (NOT AVRO_FOUND)
MESSAGE(FATAL_ERROR "Could not find Avro C-API static library: https://avro.apache.org/docs/1.8.2/")
endif()
include_directories(${AVRO_INCLUDE_DIRS})

# Disable no-deprecated-declarations
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -Wall -Wunused -Wwrite-strings -Wno-strict-aliasing -Wextra -Wshadow -Werror -Wno-deprecated-declarations")

Expand Down
2 changes: 1 addition & 1 deletion kafka-avro-adapter/src/CMakeLists.txt
@@ -1,5 +1,5 @@
add_executable(kafka_to_avro kafka_to_avro.cpp common.cpp http_request.cpp controller.cpp kafka_consumer.cpp cs_producer.cpp)
target_link_libraries(kafka_to_avro ${MCSAPI_LIBRARIES} ${JANSSON_LIBRARIES} ${RDKAFKAPP_LIBRARIES} avro curl pthread)
target_link_libraries(kafka_to_avro ${MCSAPI_LIBRARIES} ${JANSSON_LIBRARIES} ${RDKAFKAPP_LIBRARIES} ${AVRO_LIBRARIES} curl pthread)
install(TARGETS kafka_to_avro DESTINATION "${CMAKE_INSTALL_BINDIR}")

if (WITH_TESTS)
Expand Down

0 comments on commit 8a68c40

Please sign in to comment.