# 添加文件
aux_source_directory(error_code error_code)
aux_source_directory(json json)
aux_source_directory(message message)
aux_source_directory(pahoc pahoc)
aux_source_directory(tool tool)
aux_source_directory(rabbitmq rabbitmq)

# 生成静态库
add_library(zx
        ${error_code}
        ${json}
        ${message}
        ${pahoc}
        ${tool}
        ${rabbitmq}
)

if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
    set(Rabbitmq
            /usr/lib/aarch64-linux-gnu/librabbitmq.a
            )
else()
    set(Rabbitmq
            /usr/local/lib/librabbitmq.a
            )
endif()

# 添加链接静态库
target_link_libraries(zx PUBLIC
        ${EIGEN3_LIBRARIES}
        ${OpenCV_LIBRARIES}
        ${PROTOBUF_LIBRARIES}
        ${PCL_LIBRARIES}
        ${Rabbitmq}
        paho-mqtt3a
        -lgflags
        glog::glog
)

# 安装库到安装路径
INSTALL (TARGETS zx
        DESTINATION lib
)
