From 2083e9cf05ca64c12ec2aae42aac9c0f2054cd53 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 23 Jan 2025 18:40:24 +0000 Subject: [PATCH] cmake: Fix `-pthread` flags in summary --- cmake/module/GetTargetInterface.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/module/GetTargetInterface.cmake b/cmake/module/GetTargetInterface.cmake index 1e455d456b4..bbeb7d7a225 100644 --- a/cmake/module/GetTargetInterface.cmake +++ b/cmake/module/GetTargetInterface.cmake @@ -32,7 +32,18 @@ endfunction() function(get_target_interface var config target property) get_target_property(result ${target} INTERFACE_${property}) if(result) - evaluate_generator_expressions(result "${config}") + # On systems where pthread functionality is not provided by + # the C library implementation, the CMake FindThreads module + # sets the Threads::Threads target's compile options to + # generator expressions that evaluate to `-pthread` in this + # project. + # To improve the readability of the configuration summary, + # we skip these generator expressions. + if(${target} STREQUAL "Threads::Threads" AND ${property} STREQUAL "COMPILE_OPTIONS") + set(result -pthread) + else() + evaluate_generator_expressions(result "${config}") + endif() list(JOIN result " " result) else() set(result)