1 Star 1 Fork 0

zzz9h/modern-cpp-kafka

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 2.30 KB
一键复制 编辑 原始数据 按行查看 历史
Kenneth Jia 提交于 2020-09-24 11:39 +08:00 . Update on_pull_request.yml
project("kafka-tools")
#---------------------------
# Check boost directory
#---------------------------
if(DEFINED ENV{BOOST_ROOT})
set(Boost_INCLUDE_DIRS $ENV{BOOST_ROOT}/include)
set(Boost_LIBRARY_DIRS $ENV{BOOST_ROOT}/lib)
else()
find_package(Boost)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost not found!")
endif()
endif()
message(STATUS "boost include directory: ${Boost_INCLUDE_DIRS}")
message(STATUS "boost library directory: ${Boost_LIBRARY_DIRS}")
#---------------------------
# Check pthread lib directory
#---------------------------
find_library(PTHREAD_LIB pthread)
if(PTHREAD_LIB)
message(STATUS "pthread library: ${PTHREAD_LIB}")
else()
message(FATAL_ERROR "Could not find library: pthread!")
endif()
#---------------------------
# Check sasl lib directory
#---------------------------
if(DEFINED ENV{SASL_LIBRARYDIR})
set(SASL_LIBRARYDIR $ENV{SASL_LIBRARYDIR})
link_directories(${SASL_LIBRARYDIR})
message(STATUS "sasl2 library directory: ${SASL_LIBRARYDIR}")
endif()
if(DEFINED ENV{SASL_LIBRARY})
set(SASL_LIBRARY $ENV{SASL_LIBRARY})
message(STATUS "sasl2 library: ${SASL_LIBRARY}")
endif()
# Directories
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
# Target: kafka-topics
set(KafkaTopics kafka-topics)
add_executable("${KafkaTopics}" "KafkaTopics.cc")
target_link_libraries("${KafkaTopics}" modern-cpp-kafka-api)
target_link_libraries("${KafkaTopics}" "pthread;boost_program_options;${SASL_LIBRARY}")
install(TARGETS "${KafkaTopics}" DESTINATION tools)
# Target: kafka-console-consumer
set(KafkaConsoleConsumer kafka-console-consumer)
add_executable("${KafkaConsoleConsumer}" "KafkaConsoleConsumer.cc")
target_link_libraries("${KafkaConsoleConsumer}" modern-cpp-kafka-api)
target_link_libraries("${KafkaConsoleConsumer}" "pthread;boost_program_options;${SASL_LIBRARY}")
install(TARGETS "${KafkaConsoleConsumer}" DESTINATION tools)
# Target: kafka-console-producer
set(KafkaConsoleProducer kafka-console-producer)
add_executable("${KafkaConsoleProducer}" "KafkaConsoleProducer.cc")
target_link_libraries("${KafkaConsoleProducer}" modern-cpp-kafka-api)
target_link_libraries("${KafkaConsoleProducer}" "pthread;boost_program_options;${SASL_LIBRARY}")
install(TARGETS "${KafkaConsoleProducer}" DESTINATION tools)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zzz9h/modern-cpp-kafka.git
git@gitee.com:zzz9h/modern-cpp-kafka.git
zzz9h
modern-cpp-kafka
modern-cpp-kafka
main

搜索帮助