Skip to content

cmake: Fix exporting -pthread to pkgconfig - #965

Merged
bradh352 merged 1 commit into
c-ares:mainfrom
dg0yt:pkgconfig
Jan 26, 2025
Merged

cmake: Fix exporting -pthread to pkgconfig#965
bradh352 merged 1 commit into
c-ares:mainfrom
dg0yt:pkgconfig

Conversation

@dg0yt

@dg0yt dg0yt commented Jan 26, 2025

Copy link
Copy Markdown
Contributor

Before this change, libcares.pc contained -l-pthread.
Noticed in the vcpkg port.

@bradh352

Copy link
Copy Markdown
Member

I'm assuming that means THREADS_PREFER_PTHREAD_FLAG is being set somewhere, since that's not otherwise the default behavior in cmake.

Fix seems reasonable though.

@dg0yt

dg0yt commented Jan 26, 2025

Copy link
Copy Markdown
Contributor Author

I'm assuming that means THREADS_PREFER_PTHREAD_FLAG is being set somewhere, since that's not otherwise the default behavior in cmake.

It is recommended, and it is there:

SET (CMAKE_THREAD_PREFER_PTHREAD TRUE)

@bradh352

Copy link
Copy Markdown
Member

odd that docs show THREADS_PREFER_PTHREAD_FLAG as the variable name. https://cmake.org/cmake/help/latest/module/FindThreads.html

@bradh352
bradh352 merged commit d41db1b into c-ares:main Jan 26, 2025
@dg0yt

dg0yt commented Jan 26, 2025

Copy link
Copy Markdown
Contributor Author

You are right, it is a different identifier.

The issue came up in the android builds. Maybe it came from the toolchain. THREADS_PREFER_PTHREAD_FLAG is more a toolchain setting than a project setting - users probably want the same configuration for a given target platform.

@dg0yt
dg0yt deleted the pkgconfig branch January 26, 2025 15:59
bradh352 pushed a commit that referenced this pull request Apr 5, 2025
Before this change, libcares.pc contained ` -l-pthread`.  

Signed-off-by: Kai Pastor (@dg0yt)
bradh352 pushed a commit that referenced this pull request Apr 5, 2025
Before this change, libcares.pc contained ` -l-pthread`.  

Signed-off-by: Kai Pastor (@dg0yt)
bradh352 pushed a commit that referenced this pull request Apr 5, 2025
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
bradh352 pushed a commit that referenced this pull request Apr 5, 2025
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
bradh352 pushed a commit that referenced this pull request Apr 5, 2025
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
bradh352 pushed a commit that referenced this pull request Apr 5, 2025
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
Before this change, libcares.pc contained ` -l-pthread`.  

Signed-off-by: Kai Pastor (@dg0yt)
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
Before this change, libcares.pc contained ` -l-pthread`.

Signed-off-by: Kai Pastor (@dg0yt)
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
Before this change, libcares.pc contained ` -l-pthread`.  

Signed-off-by: Kai Pastor (@dg0yt)
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

Successfully merging this pull request may close these issues.

2 participants