Improve the QT_NAMESPACE definition in Qt6CoreExtras

The perivous version generated weird condition, and seems changing
the QT_NAMESPACE after qtbase configuration is noop, we may replace
the generated condition with the conditional generation.

Change-Id: Ifa09dba4db00099a07da2cff5505e6fd0b008289
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2024-02-06 11:52:11 +01:00
parent 75d83d5a65
commit 1fb225db13
2 changed files with 9 additions and 3 deletions

View File

@ -683,8 +683,16 @@ function(qt_internal_add_module target)
list(APPEND extra_cmake_files "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake")
list(APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}Macros.cmake")
endif()
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in")
if(target STREQUAL Core)
if(NOT "${QT_NAMESPACE}" STREQUAL "")
string(JOIN "" qtcore_namespace_definition
"set_property(TARGET \${__qt_core_target} "
"APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=${QT_NAMESPACE})"
)
endif()
set(extra_cmake_code "")
# Add some variables for compatibility with Qt5 config files.
if(QT_FEATURE_reduce_exports)

View File

@ -19,9 +19,7 @@ if (NOT QT_NO_CREATE_TARGETS)
set(__qt_core_target "${__qt_core_aliased_target}")
endif()
unset(__qt_core_aliased_target)
if (NOT "@QT_NAMESPACE@" STREQUAL "")
set_property(TARGET ${__qt_core_target} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=@QT_NAMESPACE@)
endif()
@qtcore_namespace_definition@
set_property(TARGET ${__qt_core_target} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
set_property(TARGET ${__qt_core_target} PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
endif()