summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-05-21 13:03:48 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-05-21 17:14:50 +0000
commit6ad8ad7a431139f381fc35b890f784a0b511c7cb (patch)
tree3b8f6fbbff5e09944178bb6065cee97d045b49be
parent8ec150a5254ae7864af2159fc0ff125dcaa89871 (diff)
downloadqtdoc-6ad8ad7a431139f381fc35b890f784a0b511c7cb.tar.gz
Add information about the disabling of UNICODE macros in Windows
Task-number: QTBUG-93895 Task-number: QTBUG-89951 Change-Id: I8b76c29be84ffa6073c0958b4cc1fe9592d7ce9a Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b2a0f0b3ec8a52bf2a8ddae8b0cc48fb25237208) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--doc/src/cmake/cmake-manual.qdoc10
-rw-r--r--doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake12
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/src/cmake/cmake-manual.qdoc b/doc/src/cmake/cmake-manual.qdoc
index 00924f94..5bfbeafe 100644
--- a/doc/src/cmake/cmake-manual.qdoc
+++ b/doc/src/cmake/cmake-manual.qdoc
@@ -302,6 +302,16 @@
loaded in a context where \l{QT_NO_CREATE_VERSIONLESS_FUNCTIONS} or
\l{QT_NO_CREATE_VERSIONLESS_TARGETS} might be defined. In this case you can still simplify
your code by determining the actual command or target name through a variable.
+
+ \section2 Unicode support in Windows
+
+ In Qt 6, the UNICODE AND _UNICODE compiler macros are set by default for targets that link
+ against Qt modules. This is in line with the qmake behavior, but it is a change compared to
+ the CMake API behavior in Qt 5.
+
+ Call qt_disable_unicode_defines() on the target to not set the macros.
+
+ \snippet snippets/cmake/qt5_qt6_compatible.cmake disable_unicode_defines
*/
/*!
diff --git a/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake b/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake
index 4c91b833..09c033d8 100644
--- a/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake
+++ b/doc/src/cmake/snippets/cmake/qt5_qt6_compatible.cmake
@@ -20,3 +20,15 @@ add_executable(helloworld
target_link_libraries(helloworld PRIVATE Qt${QT_VERSION_MAJOR}::Core)
#! [older_qt_versions]
+
+#! [disable_unicode_defines]
+
+find_package(Qt6 COMPONENTS Core)
+
+add_executable(helloworld
+ ...
+)
+
+qt_disable_unicode_defines(helloworld)
+
+#! [disable_unicode_defines]