Skip to content

Commit 343f348

Browse files
authored
cmake: Include "-pthread" in the pkg-config file if using pthreads (#832)
This makes sure that users of the library pass the right linker flags if linking libflac statically, with a mingw toolchain that doesn't automatically link in pthreads.
1 parent 3f1ecff commit 343f348

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎CMakeLists.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ if(MINGW AND (WITH_FORTIFY_SOURCE OR WITH_STACK_PROTECTOR))
173173
link_libraries("ssp.a")
174174
# static libraries don't carry over other static libraries in mingw
175175
# we need to export it in the pkg-config
176-
set(FLAC_STATIC_LIBS "-lssp")
176+
set(FLAC_STATIC_LIBS "${FLAC_STATIC_LIBS} -lssp")
177177
endif()
178178
elseif(NOT MSVC)
179179
set(HAVE_LIBSSP 1)
@@ -228,6 +228,7 @@ if(ENABLE_MULTITHREADING)
228228
find_package(Threads)
229229
if(CMAKE_USE_PTHREADS_INIT)
230230
set(HAVE_PTHREAD 1)
231+
set(FLAC_STATIC_LIBS "${FLAC_STATIC_LIBS} -pthread")
231232
else()
232233
if(HAVE_THREADS_H)
233234
set(HAVE_C11THREADS 1)

0 commit comments

Comments
 (0)