# Initialize ###################################################################################### Include ( cotire OPTIONAL RESULT_VARIABLE HAS_COTIRE ) Include ( pedantic OPTIONAL RESULT_VARIABLE HAS_PEDANTIC ) Include ( strip_symbols OPTIONAL RESULT_VARIABLE HAS_STRIP_SYMBOLS ) Option ( CPPAMQP_INSTALL_HEADER "Install headers of cppamqp." ON ) Option ( CPPAMQP_INSTALL_STATIC "Install static library of cppamqp." ON ) Option ( CPPAMQP_INSTALL_SHARED "Install shared library of cppamqp." ON ) Option ( CPPAMQP_INSTALL_DEBUG "Install the stripped debug informations of cppamqp." OFF ) Option ( CPPAMQP_NO_STRIP "Do not strip debug symbols from binary." OFF ) Find_Package ( rabbitmq REQUIRED ) Find_Package ( cppcore REQUIRED ) Find_Package ( cpplogging ) If ( cpplogging_FOUND ) Set ( CPPAMQP_HAS_CPPLOGGING true ) EndIf ( ) # Object Library ################################################################################## Set ( CMAKE_POSITION_INDEPENDENT_CODE ON ) Set ( CPPAMQP_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../include ) Set ( CPPAMQP_GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/include ) Configure_File ( ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/config.h.in ${CPPAMQP_GENERATED_INCLUDE_DIR}/cppamqp/config.h ) File ( GLOB_RECURSE CPPAMQP_HEADER_FILES ${CPPAMQP_INCLUDE_DIR}/*.h ) File ( GLOB_RECURSE CPPAMQP_INLINE_FILES ${CPPAMQP_INCLUDE_DIR}/*.inl ) File ( GLOB_RECURSE CPPAMQP_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) Add_Library ( cppamqp-objects OBJECT ${CPPAMQP_HEADER_FILES} ${CPPAMQP_INLINE_FILES} ${CPPAMQP_SOURCE_FILES} ) Target_Include_Directories ( cppamqp-objects PUBLIC $ $ $ ) Target_Link_Libraries ( cppamqp-objects PUBLIC cppcore::cppcore ) If ( CPPAMQP_HAS_CPPLOGGING ) Target_Link_Libraries ( cppamqp-objects PUBLIC cpplogging::cpplogging-shared ) EndIf ( ) # Static Library ################################################################################## Add_Library ( cppamqp-static STATIC $ ) Set_Target_Properties ( cppamqp-static PROPERTIES OUTPUT_NAME "${CPPAMQP_OUTPUTNAME}" VERSION ${CPPAMQP_VERSION} ) Target_Include_Directories ( cppamqp-static PUBLIC $ $ $ ) If ( CPPAMQP_HAS_CPPLOGGING ) Target_Link_Libraries ( cppamqp-static PUBLIC rabbitmq::rabbitmq-static cpplogging::cpplogging-static ) EndIf ( ) # Shared Library ################################################################################## Add_Library ( cppamqp-shared SHARED $ ) Set_Target_Properties ( cppamqp-shared PROPERTIES OUTPUT_NAME "${CPPAMQP_OUTPUTNAME}" VERSION ${CPPAMQP_VERSION} SOVERSION ${CPPAMQP_VERSION_SHORT} ) Target_Include_Directories ( cppamqp-shared PUBLIC $ $ $ ) If ( CPPAMQP_HAS_CPPLOGGING ) Target_Link_Libraries ( cppamqp-shared PUBLIC rabbitmq::rabbitmq-shared cpplogging::cpplogging-shared ) EndIf ( ) # Optimization #################################################################################### # pedantic If ( HAS_PEDANTIC ) Pedantic_Apply_Flags_Target ( cppamqp-objects ALL ) Pedantic_Apply_Flags_Target ( cppamqp-static ALL ) Pedantic_Apply_Flags_Target ( cppamqp-shared ALL ) EndIf ( ) # cotire If ( HAS_COTIRE ) Cotire ( cppamqp-objects ) Cotire ( cppamqp-static ) Cotire ( cppamqp-shared ) EndIf ( ) # Install ######################################################################################### # Header If ( CPPAMQP_INSTALL_HEADER ) Install ( FILES ${CPPAMQP_INCLUDE_DIR}/cppamqp.h DESTINATION ${CPPAMQP_INSTALL_DIR_INCLUDE} ) Install ( DIRECTORY ${CPPAMQP_INCLUDE_DIR}/cppamqp DESTINATION ${CPPAMQP_INSTALL_DIR_INCLUDE} ) Install ( DIRECTORY ${CPPAMQP_GENERATED_INCLUDE_DIR}/cppamqp DESTINATION ${CPPAMQP_INSTALL_DIR_INCLUDE} ) EndIf ( ) # Static If ( CPPAMQP_INSTALL_STATIC ) Install ( TARGETS cppamqp-static EXPORT cppamqp DESTINATION ${CPPAMQP_INSTALL_DIR_LIB} ) EndIf ( ) # Shared If ( CPPAMQP_INSTALL_SHARED ) Install ( TARGETS cppamqp-shared EXPORT cppamqp DESTINATION ${CPPAMQP_INSTALL_DIR_LIB} ) EndIf ( ) # Debug If ( HAS_STRIP_SYMBOLS AND NOT CPPAMQP_NO_STRIP ) Strip_Symbols ( cppamqp-shared CPPAMQP_DBG_FILE ) If ( CPPAMQP_INSTALL_DEBUG ) Install ( FILES ${CPPAMQP_DBG_FILE} DESTINATION ${CPPAMQP_INSTALL_DIR_LIB} ) EndIf ( ) EndIf ( )