Do not set properties on protobuf targets that are created in Qt build tree

If QT_NO_CREATE_TARGETS is set to true, that means we should avoid
setting any properties on Protobuf targets, otherwise these targets
either do not exists or can be aliases from Qt build tree. If the
second the respective properties should be already set.

Pick-to: 6.8 6.9
Change-Id: I96855d457ea044a75ae3a726753e245559c9d2aa
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2025-01-17 16:00:35 +01:00
parent 0227eb3daa
commit eb07b0ba42
1 changed files with 15 additions and 13 deletions

View File

@ -1,15 +1,17 @@
set(_@target@_proto_include_dirs "@proto_include_dirs@")
foreach(proto_include_dir IN LISTS _@target@_proto_include_dirs)
if(IS_ABSOLUTE "${proto_include_dir}")
set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
QT_PROTO_INCLUDES "${proto_include_dir}")
else()
set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
QT_PROTO_INCLUDES "${QT6_INSTALL_PREFIX}/${proto_include_dir}")
if(CMAKE_STAGING_PREFIX)
if(NOT QT_NO_CREATE_TARGETS)
set(_@target@_proto_include_dirs "@proto_include_dirs@")
foreach(proto_include_dir IN LISTS _@target@_proto_include_dirs)
if(IS_ABSOLUTE "${proto_include_dir}")
set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
QT_PROTO_INCLUDES "${CMAKE_STAGING_PREFIX}/${proto_include_dir}")
QT_PROTO_INCLUDES "${proto_include_dir}")
else()
set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
QT_PROTO_INCLUDES "${QT6_INSTALL_PREFIX}/${proto_include_dir}")
if(CMAKE_STAGING_PREFIX)
set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
QT_PROTO_INCLUDES "${CMAKE_STAGING_PREFIX}/${proto_include_dir}")
endif()
endif()
endif()
endforeach()
unset(_@target@_proto_include_dirs)
endforeach()
unset(_@target@_proto_include_dirs)
endif()