From: Lasse Collin Date: Sun, 16 Jun 2024 16:37:36 +0000 (+0300) Subject: CMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads X-Git-Tag: v5.6.3~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a95a9601a109f0d0d059dea7a5a44efa87ef1401;p=thirdparty%2Fxz.git CMake: Use CMAKE_THREAD_LIBS_INIT in liblzma.pc only with pthreads This shouldn't make much difference in practice as on Windows no flags are needed anyway and unitialized variable (when threading is disabled) expands to empty. But it's clearer this way. (cherry picked from commit 2aecffe0f0e14f3ef635e8cd7b405420f2385de2) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 19daabd5..aedc8e70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1412,7 +1412,13 @@ else() set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") endif() -set(PTHREAD_CFLAGS "${CMAKE_THREAD_LIBS_INIT}") +# Threads::Threads is linked in only when using POSIX threads. +# Use an empty value if using Windows threads or if threading is disabled. +set(PTHREAD_CFLAGS) +if(USE_POSIX_THREADS) + set(PTHREAD_CFLAGS "${CMAKE_THREAD_LIBS_INIT}") +endif() + configure_file(src/liblzma/liblzma.pc.in liblzma.pc @ONLY) # Install the library binary. The INCLUDES specifies the include path that