CMake: Link Threads::Threads as PRIVATE to liblzma

This way pthread options aren't passed to the linker when linking
against shared liblzma but they are still passed when linking against
static liblzma. (Also, one never needs the include path of the
threading library to use liblzma since liblzma's API headers
don't #include <pthread.h>. But <pthread.h> tends to be in the
default include path so here this change makes no difference.)

One cannot mix target_link_libraries() calls that use the scope
(PRIVATE, PUBLIC, or INTERFACE) keyword and calls that don't use it.
The calls without the keyword are like PUBLIC except perhaps when
they aren't, or something like that... It seems best to always
specify a scope keyword as the meanings of those three keywords
at least are clear.

(cherry picked from commit ac05f1b0d7)
This commit is contained in:
Lasse Collin 2024-06-15 23:34:29 +03:00
parent 258bae30a2
commit 99555b721b
No known key found for this signature in database
GPG Key ID: 38EE757D69184620
1 changed files with 1 additions and 1 deletions

View File

@ -629,7 +629,7 @@ if(ENABLE_THREADS)
# liblzma-config.cmake later.
set(USE_POSIX_THREADS ON)
target_link_libraries(liblzma Threads::Threads)
target_link_libraries(liblzma PRIVATE Threads::Threads)
add_compile_definitions(MYTHREAD_POSIX)
# Check if pthread_condattr_setclock() exists to