Skip to content

FindThreads: Do not hard-code '-l' flag on library name

Brad King requested to merge brad.king/cmake:FindThreads-lib-name into master

When not using the -pthread flag we instead return a library to link by name. Previously we hard-coded the -l flag before the library name. When used with target_link_libraries, the hard-coded -l flag is preserved rather than transformed into the link option preferred by the toolchain in use. Drop the explicit -l part to let CMake's generators produce the proper way to link the threads library for the current toolchain.

Fixes: #19747
Author: @airwin

Merge request reports