Skip to content

Commit b37d8f5

Browse files
niyuekenneth-jia
authored andcommitted
Add SASL_LIBRARY link to all sub projects.
1 parent 34405c1 commit b37d8f5

File tree

6 files changed

+20
-22
lines changed

6 files changed

+20
-22
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,18 @@ if (BUILD_OPTION_GEN_COVERAGE)
197197
message(STATUS "Enable code coverage data generation")
198198
endif ()
199199

200+
#---------------------------
201+
# Check sasl lib directory
202+
#---------------------------
203+
if(DEFINED ENV{SASL_LIBRARYDIR})
204+
set(SASL_LIBRARYDIR $ENV{SASL_LIBRARYDIR})
205+
link_directories(${SASL_LIBRARYDIR})
206+
message(STATUS "sasl2 library directory: ${SASL_LIBRARYDIR}")
207+
endif()
208+
if(DEFINED ENV{SASL_LIBRARY})
209+
set(SASL_LIBRARY $ENV{SASL_LIBRARY})
210+
message(STATUS "sasl2 library: ${SASL_LIBRARY}")
211+
endif()
200212

201213
#---------------------------
202214
# Build Sub-directories

examples/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ project("kafka-examples")
22

33
# Target: kafka_sync_producer
44
add_executable("kafka_sync_producer" "kafka_sync_producer.cc")
5-
target_link_libraries("kafka_sync_producer" modern-cpp-kafka-api)
5+
target_link_libraries("kafka_sync_producer" modern-cpp-kafka-api ${SASL_LIBRARY})
66

77
# Target: kafka_async_producer_copy_payload
88
add_executable("kafka_async_producer_copy_payload" "kafka_async_producer_copy_payload.cc")
99
target_link_libraries("kafka_async_producer_copy_payload" modern-cpp-kafka-api)
10-
target_link_libraries("kafka_async_producer_copy_payload" "pthread")
10+
target_link_libraries("kafka_async_producer_copy_payload" "pthread" ${SASL_LIBRARY})
1111

1212
# Target: kafka_async_producer_not_copy_payload
1313
add_executable("kafka_async_producer_not_copy_payload" "kafka_async_producer_not_copy_payload.cc")
1414
target_link_libraries("kafka_async_producer_not_copy_payload" modern-cpp-kafka-api)
15-
target_link_libraries("kafka_async_producer_not_copy_payload" "pthread")
15+
target_link_libraries("kafka_async_producer_not_copy_payload" "pthread" ${SASL_LIBRARY})
1616

1717
# Target: kafka_auto_commit_consumer
1818
add_executable("kafka_auto_commit_consumer" "kafka_auto_commit_consumer.cc")
19-
target_link_libraries("kafka_auto_commit_consumer" modern-cpp-kafka-api)
19+
target_link_libraries("kafka_auto_commit_consumer" modern-cpp-kafka-api ${SASL_LIBRARY})
2020

2121
# Target: kafka_manual_commit_consumer
2222
add_executable("kafka_manual_commit_consumer" "kafka_manual_commit_consumer.cc")
2323
target_link_libraries("kafka_manual_commit_consumer" modern-cpp-kafka-api)
24-
target_link_libraries("kafka_manual_commit_consumer" "pthread")
24+
target_link_libraries("kafka_manual_commit_consumer" "pthread" ${SASL_LIBRARY})

tests/integration/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ file(GLOB TEST_SRCS *.cc)
99

1010
add_executable("${PROJECT_NAME}" ${TEST_SRCS})
1111

12-
target_link_libraries("${PROJECT_NAME}" modern-cpp-kafka-api gtest gtest_main pthread)
12+
target_link_libraries("${PROJECT_NAME}" modern-cpp-kafka-api gtest gtest_main pthread ${SASL_LIBRARY})
1313

1414
add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME})
1515
set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "IT")

tests/robustness/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ file(GLOB TEST_SRCS *.cc)
99

1010
add_executable("${PROJECT_NAME}" ${TEST_SRCS})
1111

12-
target_link_libraries("${PROJECT_NAME}" modern-cpp-kafka-api gtest gmock gtest_main pthread)
12+
target_link_libraries("${PROJECT_NAME}" modern-cpp-kafka-api gtest gmock gtest_main pthread ${SASL_LIBRARY})
1313

1414
add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME})
1515
set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "RT")

tests/unit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ file(GLOB TEST_SRCS *.cc)
55

66
add_executable("${PROJECT_NAME}" ${TEST_SRCS})
77

8-
target_link_libraries("${PROJECT_NAME}" modern-cpp-kafka-api rdkafka gtest gtest_main pthread)
8+
target_link_libraries("${PROJECT_NAME}" modern-cpp-kafka-api rdkafka gtest gtest_main pthread ${SASL_LIBRARY})
99

1010
add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME})
1111
set_tests_properties(${PROJECT_NAME} PROPERTIES LABELS "UT")

tools/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,6 @@ else()
2626
message(FATAL_ERROR "Could not find library: pthread!")
2727
endif()
2828

29-
#---------------------------
30-
# Check sasl lib directory
31-
#---------------------------
32-
if(DEFINED ENV{SASL_LIBRARYDIR})
33-
set(SASL_LIBRARYDIR $ENV{SASL_LIBRARYDIR})
34-
link_directories(${SASL_LIBRARYDIR})
35-
message(STATUS "sasl2 library directory: ${SASL_LIBRARYDIR}")
36-
endif()
37-
if(DEFINED ENV{SASL_LIBRARY})
38-
set(SASL_LIBRARY $ENV{SASL_LIBRARY})
39-
message(STATUS "sasl2 library: ${SASL_LIBRARY}")
40-
endif()
41-
42-
4329
# Directories
4430
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
4531
link_directories(${Boost_LIBRARY_DIRS})

0 commit comments

Comments
 (0)