adjust generated target folder property

This commit is contained in:
Rick Vogel 2023-04-10 16:18:55 +02:00
parent 9ba8b8186c
commit 90ef4deeab
3 changed files with 24 additions and 0 deletions

View File

@ -163,3 +163,23 @@ macro(qsk_finalize_build_flags)
endif()
endmacro()
function(qsk_internal_sync_generated_target_folder directory)
# loop through all targets in the directory recursively and
# synchronize the generated target's folder property with
# the actual target's folder property
get_property(TARGETS DIRECTORY "${directory}" PROPERTY BUILDSYSTEM_TARGETS)
foreach(target IN LISTS TARGETS)
if(TARGET ${target}_qmlimportscan)
get_target_property(folder ${target} FOLDER)
set_target_properties(${target}_qmlimportscan PROPERTIES FOLDER ${folder})
message(DEBUG "Adjusting target '${target}_qmlimportscan' folder property to ${target}'s folder property '${folder}'")
endif()
endforeach()
# scan directory recursively
get_property(SUBDIRS DIRECTORY "${directory}" PROPERTY SUBDIRECTORIES)
foreach(SUBDIR IN LISTS SUBDIRS)
qsk_internal_sync_generated_target_folder("${SUBDIR}")
endforeach()
endfunction()

View File

@ -21,3 +21,5 @@ if( BUILD_QML_EXPORT )
add_subdirectory(glabels)
add_subdirectory(messageboxQml)
endif()
qsk_internal_sync_generated_target_folder(${CMAKE_CURRENT_LIST_DIR})

View File

@ -29,3 +29,5 @@ endif()
if(TARGET Qt::QuickWidgets)
add_subdirectory(grids)
endif()
qsk_internal_sync_generated_target_folder(${CMAKE_CURRENT_LIST_DIR})