Build Jansson if library not found
If the Jansson JSON library is not found on the system, it is built from source.
This commit is contained in:
@ -62,6 +62,12 @@ if(NOT MARIADB_CONNECTOR_FOUND)
|
|||||||
include(cmake/BuildMariaDBConnector.cmake)
|
include(cmake/BuildMariaDBConnector.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT JANSSON_FOUND)
|
||||||
|
message(STATUS "Building Jansson from source.")
|
||||||
|
include(cmake/BuildJansson.cmake)
|
||||||
|
include_directories(${JANSSON_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
# You can find the variables set by this in the FindCURL.cmake file
|
# You can find the variables set by this in the FindCURL.cmake file
|
||||||
# which is a default module in CMake.
|
# which is a default module in CMake.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
if (AVRO_FOUND AND JANSSON_FOUND)
|
if (AVRO_FOUND AND JANSSON_FOUND)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_library(maxavro maxavro.c maxavro_schema.c maxavro_record.c maxavro_file.c)
|
add_library(maxavro maxavro.c maxavro_schema.c maxavro_record.c maxavro_file.c)
|
||||||
target_link_libraries(maxavro maxscale-common jansson)
|
target_link_libraries(maxavro maxscale-common ${JANSSON_LIBRARIES})
|
||||||
|
|
||||||
add_executable(maxavrocheck maxavrocheck.c)
|
add_executable(maxavrocheck maxavrocheck.c)
|
||||||
target_link_libraries(maxavrocheck maxavro)
|
target_link_libraries(maxavrocheck maxavro)
|
||||||
|
20
cmake/BuildJansson.cmake
Normal file
20
cmake/BuildJansson.cmake
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# If the Jansson library is not found, download it and build it from source.
|
||||||
|
|
||||||
|
set(JANSSON_REPO "https://github.com/akheron/jansson.git" CACHE STRING "Jansson Git repository")
|
||||||
|
|
||||||
|
# Release 2.9 of Jansson
|
||||||
|
set(JANSSON_TAG "v2.9" CACHE STRING "Jansson Git tag")
|
||||||
|
|
||||||
|
ExternalProject_Add(jansson
|
||||||
|
GIT_REPOSITORY ${JANSSON_REPO}
|
||||||
|
GIT_TAG ${JANSSON_TAG}
|
||||||
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/jansson/install -DCMAKE_C_FLAGS=-fPIC
|
||||||
|
BINARY_DIR ${CMAKE_BINARY_DIR}/jansson
|
||||||
|
INSTALL_DIR ${CMAKE_BINARY_DIR}/jansson/install
|
||||||
|
UPDATE_COMMAND "")
|
||||||
|
|
||||||
|
set(JANSSON_FOUND TRUE CACHE INTERNAL "")
|
||||||
|
set(JANSSON_STATIC_FOUND TRUE CACHE INTERNAL "")
|
||||||
|
set(JANSSON_INCLUDE_DIR ${CMAKE_BINARY_DIR}/jansson/install/include CACHE INTERNAL "")
|
||||||
|
set(JANSSON_STATIC_LIBRARIES ${CMAKE_BINARY_DIR}/jansson/install/lib/libjansson.a CACHE INTERNAL "")
|
||||||
|
set(JANSSON_LIBRARIES ${JANSSON_STATIC_LIBRARIES} CACHE INTERNAL "")
|
2
server/modules/filter/cache/CMakeLists.txt
vendored
2
server/modules/filter/cache/CMakeLists.txt
vendored
@ -17,7 +17,7 @@ if (JANSSON_FOUND)
|
|||||||
storagefactory.cc
|
storagefactory.cc
|
||||||
storagereal.cc
|
storagereal.cc
|
||||||
)
|
)
|
||||||
target_link_libraries(cache maxscale-common jansson)
|
target_link_libraries(cache maxscale-common ${JANSSON_LIBRARIES})
|
||||||
set_target_properties(cache PROPERTIES VERSION "1.0.0")
|
set_target_properties(cache PROPERTIES VERSION "1.0.0")
|
||||||
set_target_properties(cache PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
set_target_properties(cache PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||||
install_module(cache core)
|
install_module(cache core)
|
||||||
|
@ -17,7 +17,7 @@ if (ROCKSDB_BUILT)
|
|||||||
storage_rocksdb.cc
|
storage_rocksdb.cc
|
||||||
)
|
)
|
||||||
add_dependencies(storage_rocksdb RocksDB)
|
add_dependencies(storage_rocksdb RocksDB)
|
||||||
target_link_libraries(storage_rocksdb maxscale-common jansson ${ROCKSDB_LIB} ${ROCKSDB_LINK_LIBS})
|
target_link_libraries(storage_rocksdb maxscale-common ${JANSSON_LIBRARIES} ${ROCKSDB_LIB} ${ROCKSDB_LINK_LIBS})
|
||||||
set_target_properties(storage_rocksdb PROPERTIES VERSION "1.0.0")
|
set_target_properties(storage_rocksdb PROPERTIES VERSION "1.0.0")
|
||||||
set_target_properties(storage_rocksdb PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
set_target_properties(storage_rocksdb PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||||
install_module(storage_rocksdb experimental)
|
install_module(storage_rocksdb experimental)
|
||||||
|
@ -10,7 +10,7 @@ add_library(cachetester
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_executable(testrules testrules.cc ../rules.cc)
|
add_executable(testrules testrules.cc ../rules.cc)
|
||||||
target_link_libraries(testrules maxscale-common jansson)
|
target_link_libraries(testrules maxscale-common ${JANSSON_LIBRARIES})
|
||||||
|
|
||||||
add_executable(testkeygeneration
|
add_executable(testkeygeneration
|
||||||
testkeygeneration.cc
|
testkeygeneration.cc
|
||||||
|
@ -6,7 +6,7 @@ if (JANSSON_FOUND)
|
|||||||
maskingrules.cc
|
maskingrules.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(masking maxscale-common jansson)
|
target_link_libraries(masking maxscale-common ${JANSSON_LIBRARIES})
|
||||||
set_target_properties(masking PROPERTIES VERSION "1.0.0")
|
set_target_properties(masking PROPERTIES VERSION "1.0.0")
|
||||||
set_target_properties(masking PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
set_target_properties(masking PROPERTIES LINK_FLAGS -Wl,-z,defs)
|
||||||
install_module(masking core)
|
install_module(masking core)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
include_directories(..)
|
include_directories(..)
|
||||||
|
|
||||||
add_executable(masking_testrules testrules.cc ../maskingrules.cc)
|
add_executable(masking_testrules testrules.cc ../maskingrules.cc)
|
||||||
target_link_libraries(masking_testrules maxscale-common jansson)
|
target_link_libraries(masking_testrules maxscale-common ${JANSSON_LIBRARIES})
|
||||||
|
|
||||||
add_test(TestMasking_rules masking_testrules)
|
add_test(TestMasking_rules masking_testrules)
|
||||||
|
Reference in New Issue
Block a user