Skip to content

Commit d7ccbee

Browse files
committed
Remove pthread lib dependency from windows/macOS
1 parent 88c1258 commit d7ccbee

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

.github/workflows/kafka_api_ci_tests.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,6 @@ jobs:
266266
cp -v "C:\VCPKG\INSTALLED\x86-windows\lib\manual-link\gtest_main*" "C:\VCPKG\INSTALLED\x86-windows\lib\"
267267
cp -v "C:\VCPKG\INSTALLED\x86-windows\lib\manual-link\gtest_main*" "C:\VCPKG\INSTALLED\x86-windows\lib\"
268268
269-
# Install pthread
270-
vcpkg install pthread
271-
cp -v "C:\VCPKG\INSTALLED\x86-windows\lib\pthreadVC3.lib" "C:\VCPKG\INSTALLED\x86-windows\lib\pthread.lib"
272-
cp -v "C:\VCPKG\INSTALLED\x86-windows\bin\pthreadVC3.dll" "C:\VCPKG\INSTALLED\x86-windows\bin\pthread.dll"
273-
274269
# Install boost headers/libraries
275270
vcpkg install boost-optional
276271
vcpkg install boost-algorithm

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ message(STATUS "librdkafka library directory: ${LIBRDKAFKA_LIBRARY_DIR}")
3232

3333

3434
#---------------------------
35-
# Check pthread library
35+
# Check pthread library (for linux only)
3636
#---------------------------
37-
find_library(PTHREAD_LIB pthread)
38-
if (PTHREAD_LIB)
39-
message(STATUS "pthread library: ${PTHREAD_LIB}")
40-
else ()
41-
message(FATAL_ERROR "Could not find library: pthread!")
37+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
38+
find_library(PTHREAD_LIB pthread)
39+
if (PTHREAD_LIB)
40+
message(STATUS "pthread library: ${PTHREAD_LIB}")
41+
else ()
42+
message(FATAL_ERROR "Could not find library: pthread!")
43+
endif ()
4244
endif ()
4345

4446

include/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ target_link_libraries(${PROJECT_NAME} INTERFACE rdkafka)
1414
#---------------------------
1515
# pthread
1616
#---------------------------
17-
target_link_libraries(${PROJECT_NAME} INTERFACE pthread)
17+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
18+
target_link_libraries(${PROJECT_NAME} INTERFACE pthread)
19+
endif ()
1820

1921
#---------------------------
2022
# sasl (if required)

0 commit comments

Comments
 (0)