QT_EXCLUDE_SOURCES_FROM_TRANSLATION

This property was introduced in Qt 6.7.

This target property specifies a list of source file paths that are excluded from translation. The paths may be absolute or relative to CMAKE_CURRENT_SOURCE_DIR. The paths may contain wildcards.

 qt_add_executable(myapp
     main.cpp
     untranslatable.cpp
     3rdparty/sqlite3.h
     3rdparty/sqlite3.c
 )
 set_property(TARGET myapp PROPERTY QT_EXCLUDE_SOURCES_FROM_TRANSLATION
     untranslatable.cpp
     3rdparty/*
 )

See also target property QT_EXCLUDE_FROM_TRANSLATION and directory property QT_EXCLUDE_FROM_TRANSLATION.