CMake: Expose resource source files to IDEs
Add fake targets for .qml/.js and other files added using qt6_add_resources Task-number: QTBUG-87642 Change-Id: I690b223711afe96ea7fdb4cf11b8e3317ed9bbe6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
b867daf6fa
commit
c7d1874cd1
@ -1068,6 +1068,22 @@ function(__qt_propagate_generated_resource target resource_name generated_source
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Creates fake targets and adds resource files to IDE's tree
|
||||||
|
function(_qt_internal_expose_source_file_to_ide target file)
|
||||||
|
set(ide_target_extension "other_files")
|
||||||
|
set(qml_extensions ".qml" ".js")
|
||||||
|
get_filename_component(resource_extension "${file}" LAST_EXT)
|
||||||
|
if(resource_extension IN_LIST qml_extensions)
|
||||||
|
set(ide_target_extension "qml_files")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ide_target ${target}_${ide_target_extension})
|
||||||
|
if(NOT TARGET ${ide_target})
|
||||||
|
add_custom_target(${ide_target} SOURCES "${file}")
|
||||||
|
else()
|
||||||
|
set_property(TARGET ${ide_target} APPEND PROPERTY SOURCES "${file}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
#
|
#
|
||||||
# Process resources via file path instead of QRC files. Behind the
|
# Process resources via file path instead of QRC files. Behind the
|
||||||
@ -1177,6 +1193,7 @@ function(_qt_internal_process_resource target resourceName)
|
|||||||
endif()
|
endif()
|
||||||
list(APPEND resource_dependencies ${target_dependency})
|
list(APPEND resource_dependencies ${target_dependency})
|
||||||
endif()
|
endif()
|
||||||
|
_qt_internal_expose_source_file_to_ide(${target} "${file}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# </qresource></RCC>
|
# </qresource></RCC>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user