cmake: Support UTF-8 characters in Kconfig values
We are using the CMake command 'file(STRINGS' (which defaults to only decoding ASCII) to read Kconfig configurations. When UTF-8 characters are detected they are treated as newlines. This behaviour has caused issues when users have input UTF-8 characters into Kconfig values. E.g. USB device descriptor strings. This commit adds the flag 'ENCODING "UTF-8"' to the 'file(STRINGS' command so that UTF-8 characters are correctly passed through the build system. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
parent
64f858874d
commit
777e0a1b86
|
@ -638,6 +638,7 @@ function(import_kconfig config_file)
|
|||
${config_file}
|
||||
DOT_CONFIG_LIST
|
||||
REGEX "^CONFIG_"
|
||||
ENCODING "UTF-8"
|
||||
)
|
||||
|
||||
foreach (CONFIG ${DOT_CONFIG_LIST})
|
||||
|
|
|
@ -4,6 +4,7 @@ file(STRINGS
|
|||
${AUTOCONF_H}
|
||||
CONFIG_LIST
|
||||
REGEX "^#define CONFIG_"
|
||||
ENCODING "UTF-8"
|
||||
)
|
||||
foreach (CONFIG ${CONFIG_LIST})
|
||||
string(REGEX REPLACE "#define (CONFIG_[A-Z|_|0-9]*) (.*)" "GEN_ABSOLUTE_SYM(\\1, \\2)" CONFIG ${CONFIG})
|
||||
|
|
Loading…
Reference in a new issue