diff options
Diffstat (limited to 'src/linguist/linguist/doc/cmake-properties.qdoc')
-rw-r--r-- | src/linguist/linguist/doc/cmake-properties.qdoc | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/src/linguist/linguist/doc/cmake-properties.qdoc b/src/linguist/linguist/doc/cmake-properties.qdoc new file mode 100644 index 000000000..ee518f7a7 --- /dev/null +++ b/src/linguist/linguist/doc/cmake-properties.qdoc @@ -0,0 +1,131 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! +\group cmake-directory-properties-qtlinguisttools +\title CMake Directory Properties in Qt6 LinguistTools + +\l{CMake Command Reference#Qt6::LinguistTools}{CMake Commands} know about the +following CMake directory properties: + +\sa{CMake Property Reference} +*/ + + +/*! +\page cmake-directory-property-qt-exclude-from-translation.html +\ingroup cmake-properties-qtlinguisttools +\ingroup cmake-directory-properties-qtlinguisttools +\keyword directory property QT_EXCLUDE_FROM_TRANSLATION + +\title QT_EXCLUDE_FROM_TRANSLATION + +\brief Marks the directory as excluded from translation + +\cmakepropertysince 6.7 + +Set this directory property to \c ON to exclude all targets in the directory and +its subdirectories from translation. The command +\l{qt6_collect_translation_source_targets}{qt_collect_translation_source_targets} +will skip such targets. + +To exclude a single target, use the target property \l{target property +QT_EXCLUDE_FROM_TRANSLATION}{QT_EXCLUDE_FROM_TRANSLATION}. + +\section1 Examples + +In the following example, translatable strings will not be extracted from +targets that are defined in the \c tests directory. + +\badcode +add_subdirectory(app) +add_subdirectory(tests) +set_property(DIRECTORY tests PROPERTY QT_EXCLUDE_FROM_TRANSLATION ON) +qt_add_translations(myapp) +\endcode + +Alternatively, you can set the directory property in the \c{CMakeLists.txt} of +the \c tests subdirectory. + +\badcode +# tests/CMakeLists.txt +qt_add_executable(...) +add_test(...) +set_directory_properties(PROPERTIES QT_EXCLUDE_FROM_TRANSLATION ON) +\endcode + +\sa QT_EXCLUDE_SOURCES_FROM_TRANSLATION +*/ + + +/*! +\group cmake-target-properties-qtlinguisttools +\title CMake Target Properties in Qt6 LinguistTools + +\l{CMake Command Reference#Qt6::LinguistTools}{CMake Commands} know about the +following CMake target properties: + +\sa{CMake Property Reference} +*/ + + +/*! +\page cmake-target-property-qt-exclude-from-translation.html +\ingroup cmake-properties-qtlinguisttools +\ingroup cmake-target-properties-qtlinguisttools +\keyword target property QT_EXCLUDE_FROM_TRANSLATION + +\title QT_EXCLUDE_FROM_TRANSLATION + +\brief Marks the target as excluded from translation + +\cmakepropertysince 6.7 + +Set this target property to \c ON to exclude it from translation. The command +\l{qt6_collect_translation_source_targets}{qt_collect_translation_source_targets} +will skip such targets. + +To exclude all targets under a subdirectory, use the directory property +\l{directory property QT_EXCLUDE_FROM_TRANSLATION}{QT_EXCLUDE_FROM_TRANSLATION}. + +\section1 Examples + +In the following example, translatable strings will not be extracted from the \c +mytest target. + +\badcode +qt_add_executable(myapp main.cpp) +qt_add_executable(mytest test.cpp) +set_property(TARGET mytest PROPERTY QT_EXCLUDE_FROM_TRANSLATION ON) +qt_add_translations(myapp) +\endcode + +\sa QT_EXCLUDE_SOURCES_FROM_TRANSLATION +*/ + + +/*! +\page cmake-target-property-qt-exclude-sources-from-translation.html +\ingroup cmake-properties-qtlinguisttools +\ingroup cmake-target-properties-qtlinguisttools + +\title QT_EXCLUDE_SOURCES_FROM_TRANSLATION + +\brief List of source file paths that shall be excluded from translation + +\cmakepropertysince 6.7 + +This target property specifies a list of source file paths that are excluded +from translation. Source files that match the patterns in this exclusion list +are ignored by \c{lupdate}. + +The paths may be absolute or relative to \c{CMAKE_CURRENT_SOURCE_DIR}. The paths +may contain wildcards in a format that is accepted by +\l{QRegularExpression::wildcardToRegularExpression}. + +\snippet cmake-macros/examples.cmake exclude sources from i18n + +\sa qt_add_lupdate +\sa {target property QT_EXCLUDE_FROM_TRANSLATION} +\sa {directory property QT_EXCLUDE_FROM_TRANSLATION} +*/ |