Add FindJansson.cmake

Added find_package module for CMake which locates the Jansson libraries
and headers. This will make dependency checking easier and prevents build
failures due to missing dependencies.
This commit is contained in:
Markus Makela
2016-10-09 13:20:31 +03:00
parent e9f94dcd9d
commit 48b1583830
5 changed files with 34 additions and 12 deletions

View File

@ -1,10 +1,11 @@
if(AVRO_FOUND)
if(AVRO_FOUND AND JANSSON_FOUND)
include_directories(${AVRO_INCLUDE_DIR})
include_directories(${JANSSON_INCLUDE_DIR})
add_library(avrorouter SHARED avro.c ../binlog/binlog_common.c avro_client.c avro_schema.c avro_rbr.c avro_file.c avro_index.c)
set_target_properties(avrorouter PROPERTIES VERSION "1.0.0")
set_target_properties(avrorouter PROPERTIES LINK_FLAGS -Wl,-z,defs)
target_link_libraries(avrorouter maxscale-common jansson ${AVRO_LIBRARIES} maxavro sqlite3 lzma)
target_link_libraries(avrorouter maxscale-common ${JANSSON_LIBRARIES} ${AVRO_LIBRARIES} maxavro sqlite3 lzma)
install_module(avrorouter core)
else()
message(STATUS "Avro C libraries were not found, avrorouter will not be built.")
message(STATUS "No Avro C or Jansson libraries found, not building avrorouter.")
endif()