diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-02-04 20:01:14 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-02-05 17:11:15 +0100 |
commit | d57ccd923f0df6abf6943c97e8223c9a24f0e4ae (patch) | |
tree | 12d4779d54b591d234e0d39c2a55894b8a4f3a7d /cmake/QtAutogenHelpers.cmake | |
parent | 63a9793360d0636a1b639f759fceca37485086fa (diff) |
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>
Diffstat (limited to 'cmake/QtAutogenHelpers.cmake')
-rw-r--r-- | cmake/QtAutogenHelpers.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/QtAutogenHelpers.cmake b/cmake/QtAutogenHelpers.cmake index 55d04b5c36..489678bdf2 100644 --- a/cmake/QtAutogenHelpers.cmake +++ b/cmake/QtAutogenHelpers.cmake @@ -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) |