summaryrefslogtreecommitdiffstats
path: root/Tests/StringFileTest/CMakeLists.txt
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-08-04 16:47:22 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-06 13:23:47 (GMT)
commit5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf (patch)
treef65b3c668a8794db8419861839d705400a88e116 /Tests/StringFileTest/CMakeLists.txt
parentffa373e71114727dd70f1a051414de573debb767 (diff)
downloadCMake-5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf.zip
CMake-5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf.tar.gz
CMake-5b30ec28f9610b0e6d12b017d83fc362b0ef9ecf.tar.bz2
file: Add ENCODING option to file(STRINGS) command (#10519)
Support extraction of UTF-8 strings.
Diffstat (limited to 'Tests/StringFileTest/CMakeLists.txt')
-rw-r--r--Tests/StringFileTest/CMakeLists.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index 4fa5a86..683f969 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -55,6 +55,16 @@ else()
"file(STRINGS) incorrectly read from srec file [${infile_strings}]")
endif()
+#this file has utf-8 content
+file(STRINGS test.utf8 infile_strings ENCODING UTF-8)
+list(LENGTH infile_strings content_len)
+if(content_len MATCHES "3")
+ message("file(STRINGS) correctly read from utf8 file [${infile_strings}]")
+else()
+ message(SEND_ERROR
+ "file(STRINGS) incorrectly read from utf8 file [${infile_strings}]")
+endif()
+
# String test
string(REGEX MATCH "[cC][mM][aA][kK][eE]" rmvar "CMake is great")
string(REGEX MATCHALL "[cC][mM][aA][kK][eE]" rmallvar "CMake is better than cmake or CMake")