summaryrefslogtreecommitdiffstats
path: root/src/linguist/linguist/doc/cmake-properties.qdoc
blob: ee518f7a7b961c0fcba448221bebf9d55daeae07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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}
*/