CMake build: Fix include paths passed to lupdate

The include paths that we extract from the targets often still contain
the generator expression, like $<BUILD_INTERFACE:actual/include/path>.
Throw away "paths" with generator expressions that we don't care about,
and strip the BUILD_INTERFACE expression around the paths, which are the
ones that we do care about.

This wasn't only partially relevant so far, though it probably was the
reason for the need for fully qualified tr(...) calls at some places.
It becomes essential when we move to the <Plugin>::Tr class, which
requires an include to <plugin>tr.h, which is otherwise not found for
files that are not in the same directory.

Change-Id: I7a0183f002973069839920ec29944342cfd91721
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2022-07-08 14:15:11 +02:00
parent f49ffa0ab4
commit 1cb4f33dfb

View File

@@ -18,6 +18,9 @@ function(_extract_ts_data_from_targets outprefix)
if (NOT _skip_translation) if (NOT _skip_translation)
if(_include_dirs) if(_include_dirs)
list(FILTER _include_dirs EXCLUDE REGEX "\\$<TARGET_PROPERTY")
list(FILTER _include_dirs EXCLUDE REGEX "\\$<INSTALL_INTERFACE")
list(TRANSFORM _include_dirs REPLACE "\\$<BUILD_INTERFACE:([^>]+)>" "\\1")
list(APPEND _includes ${_include_dirs}) list(APPEND _includes ${_include_dirs})
endif() endif()