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:
parent
e9f94dcd9d
commit
48b1583830
@ -41,6 +41,7 @@ find_package(Git)
|
||||
find_package(CURL)
|
||||
find_package(RabbitMQ)
|
||||
find_package(LibUUID)
|
||||
find_package(Jansson)
|
||||
find_package(Avro)
|
||||
find_package(GSSAPI)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
if (AVRO_FOUND)
|
||||
if (AVRO_FOUND AND JANSSON_FOUND)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_library(maxavro maxavro.c maxavro_schema.c maxavro_record.c maxavro_file.c)
|
||||
target_link_libraries(maxavro maxscale-common jansson)
|
||||
|
16
cmake/FindJansson.cmake
Normal file
16
cmake/FindJansson.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
# This CMake file locates the Jansson libraries and headers
|
||||
#
|
||||
# The following variables are set:
|
||||
# JANSSON_FOUND - If the Avro C library was found
|
||||
# JANSSON_LIBRARIES - Path to the static library
|
||||
# JANSSON_INCLUDE_DIR - Path to Avro headers
|
||||
|
||||
find_path(JANSSON_INCLUDE_DIR jansson.h)
|
||||
find_library(JANSSON_LIBRARIES NAMES libjansson.a libjansson.so)
|
||||
|
||||
if (JANSSON_INCLUDE_DIR AND JANSSON_LIBRARIES)
|
||||
message(STATUS "Found Jansson: ${JANSSON_LIBRARIES}")
|
||||
set(JANSSON_FOUND TRUE)
|
||||
else()
|
||||
message(STATUS "Could not find Jansson")
|
||||
endif()
|
20
server/modules/filter/cache/CMakeLists.txt
vendored
20
server/modules/filter/cache/CMakeLists.txt
vendored
@ -1,11 +1,15 @@
|
||||
add_library(cache SHARED cache.c rules.c storage.c)
|
||||
target_link_libraries(cache maxscale-common jansson)
|
||||
set_target_properties(cache PROPERTIES VERSION "1.0.0")
|
||||
set_target_properties(cache PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||
install_module(cache experimental)
|
||||
if (JANSSON_FOUND)
|
||||
add_library(cache SHARED cache.c rules.c storage.c)
|
||||
target_link_libraries(cache maxscale-common jansson)
|
||||
set_target_properties(cache PROPERTIES VERSION "1.0.0")
|
||||
set_target_properties(cache PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||
install_module(cache experimental)
|
||||
|
||||
add_subdirectory(storage)
|
||||
add_subdirectory(storage)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "No Jansson libraries found, not building cache filter.")
|
||||
endif()
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user