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.
This commit is contained in:
Lasse Collin 2024-06-15 23:34:29 +03:00
parent 82986d8c69
commit ac05f1b0d7
1 changed files with 1 additions and 1 deletions

View File

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