CMake: Fix list(REMOVE_ITEM) usage with older CMakes

Older CMakes error out with

CMake Error at cmake/QtSyncQtHelpers.cmake:156 (list):
  list sub-command REMOVE_ITEM requires two or more arguments.

if the last expanded variable is empty.

Fix by doing an explicit non-emptiness check.

Amends e7834e90f38891382f830da7700f00ebd81f21a8

Pick-to: 6.8 6.9
Task-number: QTBUG-134672
Task-number: QTBUG-128730
Change-Id: I3c355a02519c2c450235770b2ff8c92416615a9f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2025-03-24 12:57:41 +01:00
parent c3762aa30a
commit 9ff4b5341f

View File

@ -153,7 +153,9 @@ function(qt_internal_target_sync_headers target
# Filter out all headers that should be excluded from documentation generation.
# Documentation generation shouldn't depend on headers like the dbus-generated ones.
set(module_headers_for_docs "${module_headers}")
list(REMOVE_ITEM module_headers_for_docs ${module_headers_exclude_from_docs})
if(module_headers_exclude_from_docs)
list(REMOVE_ITEM module_headers_for_docs ${module_headers_exclude_from_docs})
endif()
set(syncqt_staging_dir "${module_build_interface_include_dir}/.syncqt_staging")