qt_allow_non_utf8_sources
Impedisce che i file sorgente vengano trattati come UTF-8 in Windows.
Il comando è definito nel componente ` Core ` del pacchetto ` Qt6 `, che può essere caricato in questo modo:
find_package(Qt6 REQUIRED COMPONENTS Core)Questo comando è stato introdotto in Qt 6.0.
Sintassi
qt_allow_non_utf8_sources(target)Se i comandi senza versione sono disabilitati, utilizzare invece qt6_allow_non_utf8_sources(). Supporta lo stesso insieme di argomenti di questo comando.
Descrizione
Durante la compilazione con alcuni compilatori per Windows, i target che si collegano a una libreria Qt utilizzano flag che costringono il compilatore a trattare i propri file sorgente come UTF-8. Attualmente questa funzionalità è implementata per i compilatori Visual Studio e Intel. È possibile disabilitare questo comportamento a livello di singolo target chiamando qt_allow_non_utf8_sources() e passando il target come argomento.
Nota: ciò non modifica il comportamento in fase di esecuzione di classi come ` QString ` (il suo costruttore, definito in ` const char * `, richiede un input UTF-8 correttamente codificato). Utilizzare le macro ` QT_NO_CAST_FROM_ASCII ` e ` QT_RESTRICTED_CAST_FROM_ASCII ` per identificare più facilmente tale codice.
{cmake-target-property-QT_NO_UTF8_SOURCE}
Vedi anche qt_disable_unicode_defines().
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.