Add framework paths when generating moc manually

In apple systems it's necessary to pass the framework paths to the moc
generator to resolve required header files. We need to collect framework
paths for all INCLUDE_DIRECTORY_TARGETS and add them to the command line
of the moc generator.

Task-number: QTBUG-84906
Change-Id: I9e6356e7e0a5f2493823ec764a48b0b8f1c8c10d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexey Edelev 2021-02-04 20:01:14 +01:00
parent 63a9793360
commit d57ccd923f

View File

@ -103,6 +103,26 @@ function(qt_manual_moc result)
set(include_expr "$<TARGET_PROPERTY:${dep},INTERFACE_INCLUDE_DIRECTORIES>")
list(APPEND moc_parameters
"$<$<BOOL:${include_expr}>:-I\n$<JOIN:${include_expr},\n-I\n>>")
if(APPLE AND TARGET ${dep})
get_target_property(is_versionless ${dep} _qt_is_versionless_target)
if(is_versionless)
string(REGEX REPLACE "^Qt::(.*)" "\\1" dep "${dep}")
set(dep "${QT_CMAKE_EXPORT_NAMESPACE}::${dep}")
endif()
get_target_property(alias_dep ${dep} ALIASED_TARGET)
if(alias_dep)
set(dep ${alias_dep})
endif()
get_target_property(loc ${dep} IMPORTED_LOCATION)
string(REGEX REPLACE "(.*)/Qt[^/]+\\.framework.*" "\\1" loc "${loc}")
if(loc)
list(APPEND moc_parameters "\n-F\n${loc}\n")
endif()
endif()
endforeach()
set(metatypes_byproducts)