Skip to content

Commit

Permalink
Add sanity check for QT_NAMESPACE validness
Browse files Browse the repository at this point in the history
It looks like we don't even support nested namespace(RCC namespace
mangling fails). Assuming that QT_NAMESPACE should be
the valid C/C++ indentifier.

Change-Id: I5c2073c21964eb96abb3e894d83e1df65f7730b4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
  • Loading branch information
semlanik committed Feb 6, 2024
1 parent 1fb225d commit 4370532
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmake/QtModuleHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,11 @@ function(qt_internal_add_module target)
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake.in")
if(target STREQUAL Core)
if(NOT "${QT_NAMESPACE}" STREQUAL "")
string(MAKE_C_IDENTIFIER "${QT_NAMESPACE}" qt_namespace_sanity)
if(NOT "${QT_NAMESPACE}" STREQUAL "${qt_namespace_sanity}")
message(FATAL_ERROR "QT_NAMESPACE is not a valid C++ identifier: "
"${QT_NAMESPACE}.")
endif()
string(JOIN "" qtcore_namespace_definition
"set_property(TARGET \${__qt_core_target} "
"APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=${QT_NAMESPACE})"
Expand Down

0 comments on commit 4370532

Please sign in to comment.