Manage the <module>_DEFINITIONS transformation accurately

Ensure that -D is not prepended to the special sequences like generator
expressions.

Pick-to: 6.5 6.7 6.8
Change-Id: I295c289e3d188780d697ff8c62d8c8fc2df6522c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2024-07-02 18:04:14 +02:00
parent ecf8843720
commit ff391b5c17

View File

@ -58,7 +58,16 @@ if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND)
if(NOT @QT_CMAKE_EXPORT_NAMESPACE@@target@_DEFINITIONS)
set(@QT_CMAKE_EXPORT_NAMESPACE@@target@_DEFINITIONS "")
else()
list(TRANSFORM @QT_CMAKE_EXPORT_NAMESPACE@@target@_DEFINITIONS PREPEND "-D")
set(updated_defs "")
foreach(def IN LISTS @QT_CMAKE_EXPORT_NAMESPACE@@target@_DEFINITIONS)
if(def MATCHES "^[A-Za-z_]")
list(APPEND updated_defs "-D${def}")
else()
list(APPEND updated_defs "${def}")
endif()
endforeach()
set(@QT_CMAKE_EXPORT_NAMESPACE@@target@_DEFINITIONS "${updated_defs}")
unset(updated_defs)
endif()
get_target_property(@QT_CMAKE_EXPORT_NAMESPACE@@target@_COMPILE_DEFINITIONS