feat: implement BasicMessage and core AMQP client infrastructure
This commit is contained in:
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(SimpleAmqpClient LANGUAGES CXX)
|
||||
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 98)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
@@ -45,30 +45,6 @@ set(SAC_APIVERSION ${_API_VERSION_MAJOR}.${_API_VERSION_MINOR}.${_API_VERSION_PA
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build SimpleAmqpClient as a shared library" ON)
|
||||
|
||||
# Force the use of static boost library for static libraries
|
||||
include(CMakeDependentOption)
|
||||
|
||||
cmake_dependent_option(
|
||||
Boost_Dynamic_Linking_ENABLED
|
||||
"Enable boost dynamic linking"
|
||||
ON
|
||||
"BUILD_SHARED_LIBS"
|
||||
OFF
|
||||
)
|
||||
|
||||
if(Boost_Dynamic_Linking_ENABLED)
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
else()
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
|
||||
find_package(Boost 1.47.0 COMPONENTS chrono REQUIRED)
|
||||
if(Boost_VERSION VERSION_LESS 1.89)
|
||||
find_package(Boost 1.47.0 COMPONENTS chrono system REQUIRED)
|
||||
endif()
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
||||
# Try using the CMake config modules first
|
||||
find_package(rabbitmq-c CONFIG QUIET)
|
||||
@@ -158,16 +134,12 @@ set(SAC_LIB_SRCS
|
||||
|
||||
|
||||
add_library(SimpleAmqpClient ${SAC_LIB_SRCS})
|
||||
target_link_libraries(SimpleAmqpClient ${Rabbitmqc_LIBRARY} ${SOCKET_LIBRARY} ${Boost_LIBRARIES} $<$<BOOL:${Boost_Dynamic_Linking_ENABLED}>:Boost::dynamic_linking>)
|
||||
target_link_libraries(SimpleAmqpClient ${Rabbitmqc_LIBRARY} ${SOCKET_LIBRARY})
|
||||
|
||||
if (WIN32)
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(SimpleAmqpClient PUBLIC SimpleAmqpClient_STATIC)
|
||||
endif ()
|
||||
|
||||
set_target_properties(SimpleAmqpClient PROPERTIES VERSION ${SAC_VERSION} OUTPUT_NAME SimpleAmqpClient.${SAC_SOVERSION})
|
||||
else ()
|
||||
set_target_properties(SimpleAmqpClient PROPERTIES VERSION ${SAC_VERSION} SOVERSION ${SAC_SOVERSION})
|
||||
endif ()
|
||||
|
||||
# Some smoke tests:
|
||||
@@ -177,24 +149,7 @@ option(ENABLE_TESTING "Enable smoke tests" OFF)
|
||||
if (ENABLE_TESTING)
|
||||
enable_testing()
|
||||
|
||||
set(BUILD_GTEST ON CACHE BOOL "" FORCE)
|
||||
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# This only affects targets declared after this.
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
mark_as_advanced(BUILD_GMOCK)
|
||||
mark_as_advanced(BUILD_GTEST)
|
||||
mark_as_advanced(INSTALL_GTEST)
|
||||
mark_as_advanced(gmock_build_tests)
|
||||
mark_as_advanced(gtest_build_samples)
|
||||
mark_as_advanced(gtest_build_tests)
|
||||
mark_as_advanced(gtest_disable_pthreads)
|
||||
mark_as_advanced(gtest_force_shared_crt)
|
||||
mark_as_advanced(gtest_hide_internal_symbols)
|
||||
|
||||
add_subdirectory(third-party/googletest)
|
||||
find_package(xgoogletest CONFIG REQUIRED)
|
||||
add_subdirectory(testing)
|
||||
endif (ENABLE_TESTING)
|
||||
|
||||
@@ -284,7 +239,7 @@ else (BUILD_SHARED_LIBS)
|
||||
set(extra_win32_targets "${Rabbitmqc_LIBRARY};${SOCKET_LIBRARY}")
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
foreach(_lib ${Boost_LIBRARIES} ${extra_win32_targets})
|
||||
foreach(_lib ${extra_win32_targets})
|
||||
|
||||
# Check if FindBoost.cmake provided actual library paths or targets
|
||||
if(TARGET ${_lib})
|
||||
|
||||
Reference in New Issue
Block a user