Skip to content

Commit

Permalink
Improve the QT_NAMESPACE definition in Qt6CoreExtras
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
semlanik committed Feb 6, 2024
1 parent 75d83d5 commit 1fb225d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 8 additions & 0 deletions cmake/QtModuleHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions src/corelib/Qt6CoreConfigExtras.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 1fb225d

Please sign in to comment.