CMake: Improve long paths handling for static builds

Use number-based naming of object libraries produced for generated
resources. This reduces path length of subdirectories for object
library targets.

Amends 08eb485a006dc2baca42eb280ae60e9f0fc00dff

Pick-to: 6.0
Change-Id: I1a449290e8a9b969601a1cc1abc6fdcfc0cd9454
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2020-11-26 17:13:49 +01:00
parent 604a8c7acc
commit af0a9375f3

View File

@ -1060,7 +1060,14 @@ endfunction()
function(__qt_propagate_generated_resource target resource_name generated_source_code output_generated_target)
get_target_property(type ${target} TYPE)
if(type STREQUAL STATIC_LIBRARY)
set(resource_target "${target}_resources_${resource_name}")
get_target_property(resource_count ${target} _qt_generated_resource_target_count)
if(NOT resource_count)
set(resource_count "0")
endif()
math(EXPR resource_count "${resource_count} + 1")
set_target_properties(${target} PROPERTIES _qt_generated_resource_target_count ${resource_count})
set(resource_target "${target}_resources_${resource_count}")
add_library("${resource_target}" OBJECT "${generated_source_code}")
set_property(TARGET ${resource_target} APPEND PROPERTY _qt_resource_name ${resource_name})