Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
toge opened this issue Oct 24, 2024 · 0 comments
Open

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

toge opened this issue Oct 24, 2024 · 0 comments

Comments

@toge
Copy link

toge commented Oct 24, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant