Skip to content

Commit 2083e9c

Browse files
committed
cmake: Fix -pthread flags in summary
1 parent 188b021 commit 2083e9c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmake/module/GetTargetInterface.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,18 @@ endfunction()
3232
function(get_target_interface var config target property)
3333
get_target_property(result ${target} INTERFACE_${property})
3434
if(result)
35-
evaluate_generator_expressions(result "${config}")
35+
# On systems where pthread functionality is not provided by
36+
# the C library implementation, the CMake FindThreads module
37+
# sets the Threads::Threads target's compile options to
38+
# generator expressions that evaluate to `-pthread` in this
39+
# project.
40+
# To improve the readability of the configuration summary,
41+
# we skip these generator expressions.
42+
if(${target} STREQUAL "Threads::Threads" AND ${property} STREQUAL "COMPILE_OPTIONS")
43+
set(result -pthread)
44+
else()
45+
evaluate_generator_expressions(result "${config}")
46+
endif()
3647
list(JOIN result " " result)
3748
else()
3849
set(result)

0 commit comments

Comments
 (0)