diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-11-17 17:43:48 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-11-19 06:29:02 +0100 |
commit | b233b5f31e19dd5c2636790f2732e06f1b88a99f (patch) | |
tree | 02c1f24228694f67f39a5cf711f15114d81be2a2 /cmake | |
parent | f9dcade5e795a631b9a2d93c855aa8198d58e24e (diff) |
CMake: Extract resource object file recording into new function
This function will be used by qtdeclarative CMake functions to record
resource object file information for Qml-specific generated resources
(like the ones containing qmldir and qml files).
Task-number: QTBUG-87702
Change-Id: I17c295821775d005dea82d9fbdf83d7ee613f615
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtResourceHelpers.cmake | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/cmake/QtResourceHelpers.cmake b/cmake/QtResourceHelpers.cmake index a4f1050c0d..e37cd03cd7 100644 --- a/cmake/QtResourceHelpers.cmake +++ b/cmake/QtResourceHelpers.cmake @@ -21,28 +21,32 @@ function(qt_internal_add_resource target resourceName) EXPORT "${INSTALL_CMAKE_NAMESPACE}${target}Targets" DESTINATION ${INSTALL_LIBDIR} ) - foreach(out_target ${out_targets}) - get_target_property(resource_name ${out_target} QT_RESOURCE_NAME) - if(NOT resource_name) - continue() - endif() - if(QT_WILL_INSTALL) - # Compute the install location of the rcc object file. - # This is the relative path below the install destination (install_prefix/lib). - # See CMake's computeInstallObjectDir function. - set(object_file_name "qrc_${resource_name}.cpp${CMAKE_CXX_OUTPUT_EXTENSION}") - qt_path_join(rcc_object_file_path - "objects-$<CONFIG>" ${out_target} .rcc "${object_file_name}") - else() - # In a non-prefix build we use the object file paths right away. - set(rcc_object_file_path $<TARGET_OBJECTS:$<TARGET_NAME:${out_target}>>) - endif() - set_property(TARGET ${target} APPEND PROPERTY QT_RCC_OBJECTS "${rcc_object_file_path}") - # Make sure that the target cpp files are compiled with the regular Qt internal compile - # flags, needed for building iOS apps with qmake where bitcode is involved. - target_link_libraries("${out_target}" PRIVATE Qt::PlatformModuleInternal) - endforeach() + qt_internal_record_rcc_object_files("${target}" "${out_targets}") endif() +endfunction() + +function(qt_internal_record_rcc_object_files target resource_targets) + foreach(out_target ${resource_targets}) + get_target_property(resource_name ${out_target} QT_RESOURCE_NAME) + if(NOT resource_name) + continue() + endif() + if(QT_WILL_INSTALL) + # Compute the install location of the rcc object file. + # This is the relative path below the install destination (install_prefix/lib). + # See CMake's computeInstallObjectDir function. + set(object_file_name "qrc_${resource_name}.cpp${CMAKE_CXX_OUTPUT_EXTENSION}") + qt_path_join(rcc_object_file_path + "objects-$<CONFIG>" ${out_target} .rcc "${object_file_name}") + else() + # In a non-prefix build we use the object file paths right away. + set(rcc_object_file_path $<TARGET_OBJECTS:$<TARGET_NAME:${out_target}>>) + endif() + set_property(TARGET ${target} APPEND PROPERTY QT_RCC_OBJECTS "${rcc_object_file_path}") + # Make sure that the target cpp files are compiled with the regular Qt internal compile + # flags, needed for building iOS apps with qmake where bitcode is involved. + target_link_libraries("${out_target}" PRIVATE Qt::PlatformModuleInternal) + endforeach() endfunction() |