From 99555b721b55263a6892b1093f2806f09a92e1fb Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 15 Jun 2024 23:34:29 +0300 Subject: [PATCH] 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 . But 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 ac05f1b0d7cda1e7ae79775a8dfecc54601d7f1c) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb701ec3..d60649d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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