From 52fdb9dc93c9e9c372d8d4a95b97a32bf091579d Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 12 Aug 2020 12:34:06 +0000 Subject: [PATCH] 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 --- cmake/QtBuild.cmake | 20 ++++++++++++++++++++ cmake/QtPostProcess.cmake | 2 ++ 2 files changed, 22 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 959581e2880..6d5e7175b89 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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 "^\\$ + # 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. diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake index 02c1905f8b4..6e365ec7347 100644 --- a/cmake/QtPostProcess.cmake +++ b/cmake/QtPostProcess.cmake @@ -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)