summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/StringFileTest/CMakeLists.txt23
1 files changed, 21 insertions, 2 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index b2a62cb..2af415a 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -1,7 +1,10 @@
PROJECT(StringFileTest)
INCLUDE_DIRECTORIES(${StringFileTest_BINARY_DIR})
+# Read file test
FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile)
+
+# 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")
STRING(REGEX REPLACE "[Aa][uU][tT][oO]([cC][oO][nN][fF]|[mM][aA][kK][eE])"
@@ -18,8 +21,20 @@ STRING(ASCII 67 109 97 107 101 savar)
STRING(TOUPPER "CMake" tuvar)
STRING(TOLOWER "CMake" tlvar)
-FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Includes")
+# Escaping test
+SET(var "\\ \" \ \t \n \r \# \( \) \0")
+MESSAGE(STATUS "Output: [${var}]")
+SET(var \\ \" \ \t \n \r \# \( \) \0)
+MESSAGE(STATUS "Output: [${var}]")
+
+# Make directories test
+FILE(MAKE_DIRECTORY
+ "${CMAKE_CURRENT_BINARY_DIR}/Includes"
+ "${CMAKE_CURRENT_BINARY_DIR}/Directory1"
+ "${CMAKE_CURRENT_BINARY_DIR}/Directory2"
+ )
+# Write results to the file (test write file)
SET(file "${CMAKE_CURRENT_BINARY_DIR}/Includes/Values.h")
FILE(WRITE "${file}" "/* this file is generated */\n")
FOREACH(var
@@ -40,7 +55,11 @@ FOREACH(var
FILE(APPEND "${file}" "#define ${var} \"${${var}}\"\n")
ENDFOREACH(var)
+# Write include file to a file
STRING(REGEX REPLACE "includefile" "${file}" outfile "${infile}")
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h" "${outfile}")
-ADD_EXECUTABLE(StringFileTest StringFile.cxx)
+# Test file glob
+FILE(GLOB src_files "${CMAKE_CURRENT_SOURCE_DIR}/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx")
+
+ADD_EXECUTABLE(StringFileTest ${src_files})