diff options
Diffstat (limited to 'Tests/StringFileTest/CMakeLists.txt')
-rw-r--r-- | Tests/StringFileTest/CMakeLists.txt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt new file mode 100644 index 0000000..bd404a4 --- /dev/null +++ b/Tests/StringFileTest/CMakeLists.txt @@ -0,0 +1,46 @@ +PROJECT(StringFileTest) +INCLUDE_DIRECTORIES(${StringFileTest_BINARY_DIR}) + +FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile) +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])" + "CMake" rrepvar "People should use Autoconf and Automake") +STRING(COMPARE EQUAL "CMake" "Autoconf" nceqvar) +STRING(COMPARE EQUAL "CMake" "CMake" ceqvar) +STRING(COMPARE NOTEQUAL "CMake" "Autoconf" cneqvar) +STRING(COMPARE NOTEQUAL "CMake" "CMake" ncneqvar) +STRING(COMPARE LESS "before" "after" nclvar) +STRING(COMPARE LESS "max" "min" clvar) +STRING(COMPARE GREATER "before" "after" cgvar) +STRING(COMPARE GREATER "max" "min" ncgvar) +STRING(ASCII 67 109 97 107 101 savar) +STRING(TOUPPER "CMake" tuvar) +STRING(TOLOWER "CMake" tlvar) + +FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Includes") + +SET(file "${CMAKE_CURRENT_BINARY_DIR}/Includes/Values.h") +FILE(WRITE "${file}" "/* this file is generated */\n") +FOREACH(var + rmvar + rmallvar + rrepvar + nceqvar + ceqvar + cneqvar + ncneqvar + nclvar + clvar + cgvar + ncgvar + savar + tuvar + tlvar) + FILE(APPEND "${file}" "#define ${var} \"${${var}}\"") +ENDFOREACH(var) + +STRING(REGEX REPLACE "includefile" "${file}" outfile "${infile}") +FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h" "${outfile}") + +ADD_EXECUTABLE(StringFileTest StringFile.cxx) |