Skip to content

Commit

Permalink
Fix pthreads linking on Windows for libmosquitto_static
Browse files Browse the repository at this point in the history
Closes #3143
  • Loading branch information
ralight committed Oct 30, 2024
1 parent e99a97b commit 67ef993
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2.0.21 - 2024-xx-xx
===================

Client library:
- Fix threads linking on Windows for static libmosquitto library
Closes #3143

Build:
- Fix Windows builds not having websockets enabled.


2.0.20 - 2024-10-16
===================

Expand Down
8 changes: 4 additions & 4 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ set_target_properties(libmosquitto PROPERTIES
POSITION_INDEPENDENT_CODE 1
)

target_link_libraries(libmosquitto PRIVATE ${LIBRARIES})

if (WITH_THREADING)
if(WIN32)
target_link_libraries(libmosquitto PRIVATE PThreads4W::PThreads4W)
set (LIBRARIES ${LIBRARIES} PThreads4W::PThreads4W)
else()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

target_link_libraries(libmosquitto PRIVATE Threads::Threads)
set (LIBRARIES ${LIBRARIES} Threads::Threads)
endif()
endif()

target_link_libraries(libmosquitto PRIVATE ${LIBRARIES})

set_target_properties(libmosquitto PROPERTIES
OUTPUT_NAME mosquitto
VERSION ${VERSION}
Expand Down

0 comments on commit 67ef993

Please sign in to comment.