Skip to content

Please link thread library for static build (same as shared build) #3143

Closed
@toge

Description

@toge

Mosquitto: 2.0.20
Pthreads4w: 3.0.0
OS: Windows10
Compiler: MSVC 19.40.33812

I met a compilation error on static build due to lack of pthread.h.
It works fine with following hand patch.

if (WITH_THREADING)
  if(WIN32)
    target_link_libraries(libmosquitto_static PThreads4W::PThreads4W)
  else()
    set(THREADS_PREFER_PTHREAD_FLAG ON)
    find_package(Threads REQUIRED)
    target_link_libraries(libmosquitto_static Threads::Threads)
  endif()
endif()

Is it valid workaround or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: buildRelated to the Makefiles / build scripts in the project.Component: libmosquittoStatus: CompletedNothing further to be done with this issue, it can be closed by the requestor or committer.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions