CMake: Fix Threads::Threads dependency handling with CMake < 3.18
Apparently CMake encods targets from different scopes with a different encoding scheme for earlier CMake versions. CMake 3.16.3: Threads::Threads::@<0x5604cb3f6b50> CMake 3.18.0: ::@(0x5604cb3f6b50);Threads::Threads;::@ Handle the earlier version approach as well. It needs to be done both when writing out 3rd party dependencies, as well as for lib prl files. Possibly in more places as well, but I didn't detect additional places yet. Amends 92ee9bd6b885879090ba57e49c8bd84a06d42b2b Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib348b51b2d623fb50d9080dba2beeb931d47a69c Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
parent
6b488d8950
commit
52fdb9dc93
@ -3253,6 +3253,9 @@ function(qt_internal_walk_libs target out_var dict_name operation)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# Strip any directory scope tokens.
|
||||
qt_internal_strip_target_directory_scope_token("${lib}" lib)
|
||||
|
||||
if(lib MATCHES "^\\$<TARGET_OBJECTS:")
|
||||
# Skip object files.
|
||||
continue()
|
||||
@ -6122,6 +6125,23 @@ function(qt_internal_apply_win_prefix_and_suffix target)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(qt_internal_strip_target_directory_scope_token target out_var)
|
||||
# In CMake versions earlier than CMake 3.18, a subdirectory scope id is appended to the
|
||||
# target name if the target is referenced in a target_link_libraries command from a
|
||||
# different directory scope than where the target was created.
|
||||
# Strip it.
|
||||
#
|
||||
# For informational purposes, in CMake 3.18, the target name looks as follows:
|
||||
# ::@(0x5604cb3f6b50);Threads::Threads;::@
|
||||
# This case doesn't have to be stripped (at least for now), because when we iterate over
|
||||
# link libraries, the tokens appear as separate target names.
|
||||
#
|
||||
# Example: Threads::Threads::@<0x5604cb3f6b50>
|
||||
# Output: Threads::Threads
|
||||
string(REGEX REPLACE "::@<.+>$" "" target "${target}")
|
||||
set("${out_var}" "${target}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
include(QtApp)
|
||||
|
||||
# Compatibility macros that should be removed once all their usages are removed.
|
||||
|
@ -35,6 +35,8 @@ macro(qt_collect_third_party_deps target)
|
||||
set(dep ${base_dep})
|
||||
endif()
|
||||
|
||||
# Strip any directory scope tokens.
|
||||
qt_internal_strip_target_directory_scope_token("${dep}" dep)
|
||||
if(TARGET ${dep})
|
||||
list(FIND third_party_deps_seen ${dep} dep_seen)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user