Cleaned up RabbitMQ component building.
This commit is contained in:
parent
98671de7f3
commit
fdf1271138
@ -6,7 +6,11 @@ enable_testing()
|
||||
set_variables()
|
||||
set_maxscale_version()
|
||||
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories." FORCE)
|
||||
set(CMAKE_BUILD_TYPE "${BUILD_TYPE}" CACHE INTERNAL "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. " FORCE)
|
||||
if(NOT ( BUILD_TYPE STREQUAL "None" ) )
|
||||
set(CMAKE_BUILD_TYPE "${BUILD_TYPE}" CACHE INTERNAL "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. " FORCE)
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE "")
|
||||
endif()
|
||||
|
||||
project(MaxScale)
|
||||
|
||||
@ -74,16 +78,27 @@ include_directories(server/include)
|
||||
include_directories(server/inih)
|
||||
include_directories(server/modules/include)
|
||||
|
||||
if(BUILD_RABBITMQ)
|
||||
|
||||
find_path(RABBITMQ_HEADERS amqp.h DOC "Path to the librabbitmq-c headers.")
|
||||
find_library(RABBITMQ_LIB rabbitmq DOC "Path to the librabbitmq-c libraries.")
|
||||
if(RABBITMQ_HEADERS AND RABBITMQ_LIB)
|
||||
message(STATUS "Building RabbitMQ components")
|
||||
include_directories(${RABBITMQ_HEADERS})
|
||||
link_directories(${RABBITMQ_LIB})
|
||||
add_subdirectory(rabbitmq_consumer)
|
||||
else()
|
||||
message(ERROR "Error: Cannot find the librabbitmq-c headers or libraries.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(log_manager)
|
||||
add_subdirectory(query_classifier)
|
||||
add_subdirectory(server)
|
||||
add_subdirectory(client)
|
||||
|
||||
if(BUILD_RABBITMQ)
|
||||
message(STATUS "Building RabbitMQ components")
|
||||
add_subdirectory(rabbitmq_consumer)
|
||||
endif(BUILD_RABBITMQ)
|
||||
|
||||
file(GLOB DOCS Documentation/*.pdf)
|
||||
|
||||
|
@ -1,25 +1,21 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
project (consumer)
|
||||
|
||||
find_path(RABBITMQ_C_DIRS amqp.h)
|
||||
find_library(RABBITMQ_C_LIB NAMES rabbitmq)
|
||||
find_library(MYSQL_CLIENT_LIB NAMES mysqlclient PATHS /usr/lib /usr/lib64 PATH_SUFFIXES mysql mariadb)
|
||||
|
||||
include_directories(${RABBITMQ_C_DIRS})
|
||||
if( ( RABBITMQ_LIB AND RABBITMQ_HEADERS ) AND MYSQL_CLIENT_LIB )
|
||||
|
||||
if( ( RABBITMQ_C_LIB AND RABBITMQ_C_DIRS ) AND MYSQL_CLIENT_LIB )
|
||||
|
||||
add_executable (consumer consumer.c ${MYSQL_CLIENT_LIB} ${RABBITMQ_C_LIBRARIES})
|
||||
target_link_libraries(consumer mysqlclient)
|
||||
target_link_libraries(consumer rabbitmq)
|
||||
target_link_libraries(consumer inih)
|
||||
add_executable (consumer consumer.c)
|
||||
target_link_libraries(consumer ${MYSQL_CLIENT_LIB} rabbitmq inih)
|
||||
install(TARGETS consumer DESTINATION bin)
|
||||
install(FILES consumer.cnf DESTINATION etc)
|
||||
|
||||
|
||||
else()
|
||||
message(FATAL_ERROR "Error: Can not find requred libraries.")
|
||||
|
||||
message(FATAL_ERROR "Error: Can not find requred libraries and headers: librabbitmq libmysqlclient")
|
||||
|
||||
endif()
|
||||
|
||||
# Packaging of RabbitMQ disabled for now
|
||||
|
@ -1,8 +1,12 @@
|
||||
if(BUILD_RABBITMQ)
|
||||
add_library(mqfilter SHARED mqfilter.c)
|
||||
target_link_libraries(mqfilter utils query_classifier log_manager rabbitmq)
|
||||
install(TARGETS mqfilter DESTINATION modules)
|
||||
endif(BUILD_RABBITMQ)
|
||||
if(RABBITMQ_LIB AND RABBITMQ_HEADERS)
|
||||
add_library(mqfilter SHARED mqfilter.c)
|
||||
target_link_libraries(mqfilter utils query_classifier log_manager rabbitmq)
|
||||
install(TARGETS mqfilter DESTINATION modules)
|
||||
else()
|
||||
message(ERROR "Error: Cannot find the required librabbitmq-c locations, please check that you have them configured correctly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(regexfilter SHARED regexfilter.c)
|
||||
target_link_libraries(regexfilter utils log_manager)
|
||||
|
Loading…
x
Reference in New Issue
Block a user