Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cmake-properties.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\group cmake-directory-properties-qtlinguisttools
6
\title CMake Directory Properties in Qt6 LinguistTools
7
8
\l{CMake Command Reference#Qt6::LinguistTools}{CMake Commands} know about the
9
following CMake directory properties:
10
11
\sa{CMake Property Reference}
12
*/
13
14
15
/*!
16
\page cmake-directory-property-qt-exclude-from-translation.html
17
\ingroup cmake-properties-qtlinguisttools
18
\ingroup cmake-directory-properties-qtlinguisttools
19
\keyword directory property QT_EXCLUDE_FROM_TRANSLATION
20
21
\title QT_EXCLUDE_FROM_TRANSLATION
22
23
\brief Marks the directory as excluded from translation
24
25
\cmakepropertysince 6.7
26
27
Set this directory property to \c ON to exclude all targets in the directory and
28
its subdirectories from translation. The command
29
\l qt_collect_translation_source_targets()
30
will skip such targets.
31
32
To exclude a single target, use the target property \l{target property
33
QT_EXCLUDE_FROM_TRANSLATION}{QT_EXCLUDE_FROM_TRANSLATION}.
34
35
\section1 Examples
36
37
In the following example, translatable strings will not be extracted from
38
targets that are defined in the \c tests directory.
39
40
\badcode
41
add_subdirectory(app)
42
add_subdirectory(tests)
43
set_property(DIRECTORY tests PROPERTY QT_EXCLUDE_FROM_TRANSLATION ON)
44
qt_add_translations(myapp)
45
\endcode
46
47
Alternatively, you can set the directory property in the \c{CMakeLists.txt} of
48
the \c tests subdirectory.
49
50
\badcode
51
# tests/CMakeLists.txt
52
qt_add_executable(...)
53
add_test(...)
54
set_directory_properties(PROPERTIES QT_EXCLUDE_FROM_TRANSLATION ON)
55
\endcode
56
57
\sa QT_EXCLUDE_SOURCES_FROM_TRANSLATION
58
\sa {Setting CMake variables and properties}
59
*/
60
61
62
/*!
63
\group cmake-target-properties-qtlinguisttools
64
\title CMake Target Properties in Qt6 LinguistTools
65
66
\l{CMake Command Reference#Qt6::LinguistTools}{CMake Commands} know about the
67
following CMake target properties:
68
69
\sa{CMake Property Reference}
70
*/
71
72
73
/*!
74
\page cmake-target-property-qt-exclude-from-translation.html
75
\ingroup cmake-properties-qtlinguisttools
76
\ingroup cmake-target-properties-qtlinguisttools
77
\keyword target property QT_EXCLUDE_FROM_TRANSLATION
78
79
\title QT_EXCLUDE_FROM_TRANSLATION
80
81
\brief Marks the target as excluded from translation
82
83
\cmakepropertysince 6.7
84
85
Set this target property to \c ON to exclude it from translation. The command
86
\l qt_collect_translation_source_targets()
87
will skip such targets.
88
89
To exclude all targets under a subdirectory, use the directory property
90
\l{directory property QT_EXCLUDE_FROM_TRANSLATION}{QT_EXCLUDE_FROM_TRANSLATION}.
91
92
\section1 Examples
93
94
In the following example, translatable strings will not be extracted from the \c
95
mytest target.
96
97
\badcode
98
qt_add_executable(myapp main.cpp)
99
qt_add_executable(mytest test.cpp)
100
set_property(TARGET mytest PROPERTY QT_EXCLUDE_FROM_TRANSLATION ON)
101
qt_add_translations(myapp)
102
\endcode
103
104
\sa QT_EXCLUDE_SOURCES_FROM_TRANSLATION
105
\sa {Setting CMake variables and properties}
106
*/
107
108
109
/*!
110
\page cmake-target-property-qt-exclude-sources-from-translation.html
111
\ingroup cmake-properties-qtlinguisttools
112
\ingroup cmake-target-properties-qtlinguisttools
113
114
\title QT_EXCLUDE_SOURCES_FROM_TRANSLATION
115
116
\brief List of source file paths that shall be excluded from translation
117
118
\cmakepropertysince 6.7
119
120
This target property specifies a list of source file paths that are excluded
121
from translation. Source files that match the patterns in this exclusion list
122
are ignored by \c{lupdate}.
123
124
The paths may be absolute or relative to \c{CMAKE_CURRENT_SOURCE_DIR}. The paths
125
may contain wildcards in a format that is accepted by
126
\l{QRegularExpression::wildcardToRegularExpression}.
127
128
\section1 Examples
129
130
Exclude \c untranslatable.cpp and recursively every file under the \c 3rdparty
131
directory.
132
133
\snippet cmake-macros/examples.cmake exclude sources from i18n
134
135
\sa qt_add_lupdate()
136
\sa {target property QT_EXCLUDE_FROM_TRANSLATION}
137
\sa {directory property QT_EXCLUDE_FROM_TRANSLATION}
138
\sa {Setting CMake variables and properties}
139
*/
qttools
src
linguist
linguist
doc
cmake-properties.qdoc
Generated on
for Qt by
1.16.1