CMake: Improve pri library handling for genexes and friends
After 4dce218ac400afcb54aa2a85a0b27947fec583cb got merged, we started considering the INTERFACE_LINK_LIBRARIES property of UNKNOWN_LIBRARY targets in addition to INTERFACE_LIBRARY targets, when collecting dependencies for pri file generation. These can contain genexes like $<LINK_ONLY:...> or $<TARGET_OBJECTS:...>, which are not supported by file(GENERATE), or special directory scope tokens like ::@, which are not valid targets or library names. One such case was in the downstream vcpkg build of Qt which adds `$<LINK_ONLY:EXPAT::EXPAT>` to the INTERFACE_LINK_LIBRARIES of the Fontconfig::Fontconfig target. We strip or handle these cases for prl file generation as part of calling __qt_internal_walk_libs. Change the pri generation to handle them in a similar manner by copying over the same logic. Amends 4dce218ac400afcb54aa2a85a0b27947fec583cb Fixes: QTBUG-129471 Change-Id: Id4a574ee2411f6d64179c419f352168fde1914d3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 93df3de1f30b6f65b025b33e9cd73ad479295e59) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
482287debb
commit
4053101001
@ -57,10 +57,34 @@ function(qt_generate_qmake_libraries_pri_content module_name output_root_dir out
|
||||
list(APPEND lib_incdir "${target_include_dir}")
|
||||
list(APPEND lib_defines "$<TARGET_PROPERTY:${lib_target},INTERFACE_COMPILE_DEFINITIONS>")
|
||||
else()
|
||||
if(lib_target MATCHES "/([^/]+).framework$")
|
||||
# Strip any directory scope tokens.
|
||||
__qt_internal_strip_target_directory_scope_token("${lib_target}" lib_target)
|
||||
|
||||
# Skip CMAKE_DIRECTORY_ID_SEP. If a target_link_libraries is applied to a target
|
||||
# that was defined in a different scope, CMake appends and prepends a special
|
||||
# directory id separator. Filter those out.
|
||||
if(lib_target MATCHES "^::@")
|
||||
continue()
|
||||
|
||||
elseif(lib_target MATCHES "^\\$<TARGET_OBJECTS:")
|
||||
# Skip object files.
|
||||
continue()
|
||||
|
||||
elseif(lib_target MATCHES "/([^/]+).framework$")
|
||||
# Handle frameworks
|
||||
list(APPEND lib_libs "-framework ${CMAKE_MATCH_1}")
|
||||
|
||||
elseif(lib_target MATCHES "^\\$<LINK_ONLY:(.*)>$")
|
||||
# Extract value of LINK_ONLY genex, because it can't be used in file(GENERATE)
|
||||
set(lib_target "${CMAKE_MATCH_1}")
|
||||
if(lib_target)
|
||||
list(PREPEND lib_targets ${lib_target})
|
||||
endif()
|
||||
else()
|
||||
list(APPEND lib_libs "${lib_target}")
|
||||
# Regular library name, library path, or -lfoo-like flag. Check for emptiness.
|
||||
if(lib_target)
|
||||
list(APPEND lib_libs "${lib_target}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endwhile()
|
||||
|
Loading…
x
Reference in New Issue
Block a user