summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/string
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-21 16:49:15 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-21 16:54:20 (GMT)
commit4e184a21beda9de3703ecda94085c234f5bbd7da (patch)
treee127479207d0d9677d1713ba1eb08f6d26b3a768 /Tests/RunCMake/string
parent9fb65d7090ca314cd8bfd88e52fefa6905938a6d (diff)
downloadCMake-4e184a21beda9de3703ecda94085c234f5bbd7da.zip
CMake-4e184a21beda9de3703ecda94085c234f5bbd7da.tar.gz
CMake-4e184a21beda9de3703ecda94085c234f5bbd7da.tar.bz2
string: Add CONCAT sub-command
Add a string(CONCAT) command to simply concatenate input arguments together. This will be useful for combining strings from different quoting syntaxes. Add a RunCMake.string test covering these cases.
Diffstat (limited to 'Tests/RunCMake/string')
-rw-r--r--Tests/RunCMake/string/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/string/Concat.cmake19
-rw-r--r--Tests/RunCMake/string/ConcatNoArgs-result.txt1
-rw-r--r--Tests/RunCMake/string/ConcatNoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/string/ConcatNoArgs.cmake1
-rw-r--r--Tests/RunCMake/string/RunCMakeTest.cmake4
6 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/string/CMakeLists.txt b/Tests/RunCMake/string/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/string/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/string/Concat.cmake b/Tests/RunCMake/string/Concat.cmake
new file mode 100644
index 0000000..7260c95
--- /dev/null
+++ b/Tests/RunCMake/string/Concat.cmake
@@ -0,0 +1,19 @@
+set(b b)
+set(out x)
+string(CONCAT out)
+if(NOT out STREQUAL "")
+ message(FATAL_ERROR "\"string(CONCAT out)\" set out to \"${out}\"")
+endif()
+string(CONCAT out a)
+if(NOT out STREQUAL "a")
+ message(FATAL_ERROR "\"string(CONCAT out a)\" set out to \"${out}\"")
+endif()
+string(CONCAT out a "b")
+if(NOT out STREQUAL "ab")
+ message(FATAL_ERROR "\"string(CONCAT out a \"b\")\" set out to \"${out}\"")
+endif()
+string(CONCAT out a "${b}" [[
+${c}]])
+if(NOT out STREQUAL "ab\${c}")
+ message(FATAL_ERROR "\"string(CONCAT out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"")
+endif()
diff --git a/Tests/RunCMake/string/ConcatNoArgs-result.txt b/Tests/RunCMake/string/ConcatNoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/string/ConcatNoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/string/ConcatNoArgs-stderr.txt b/Tests/RunCMake/string/ConcatNoArgs-stderr.txt
new file mode 100644
index 0000000..efea5f1
--- /dev/null
+++ b/Tests/RunCMake/string/ConcatNoArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at ConcatNoArgs.cmake:1 \(string\):
+ string sub-command CONCAT requires at least one argument.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/string/ConcatNoArgs.cmake b/Tests/RunCMake/string/ConcatNoArgs.cmake
new file mode 100644
index 0000000..ba21136
--- /dev/null
+++ b/Tests/RunCMake/string/ConcatNoArgs.cmake
@@ -0,0 +1 @@
+string(CONCAT)
diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake
new file mode 100644
index 0000000..501acd2
--- /dev/null
+++ b/Tests/RunCMake/string/RunCMakeTest.cmake
@@ -0,0 +1,4 @@
+include(RunCMake)
+
+run_cmake(Concat)
+run_cmake(ConcatNoArgs)