mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
string: add APPEND subcommand
This commit is contained in:
committed by
Brad King
parent
7e86f567ac
commit
2b18cdcaba
58
Tests/RunCMake/string/Append.cmake
Normal file
58
Tests/RunCMake/string/Append.cmake
Normal file
@@ -0,0 +1,58 @@
|
||||
set(out)
|
||||
string(APPEND out)
|
||||
if(DEFINED out)
|
||||
message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
set(out "")
|
||||
string(APPEND out)
|
||||
if(NOT out STREQUAL "")
|
||||
message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
set(out x)
|
||||
string(APPEND out)
|
||||
if(NOT out STREQUAL "x")
|
||||
message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
|
||||
set(out)
|
||||
string(APPEND out a)
|
||||
if(NOT out STREQUAL "a")
|
||||
message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
set(out "")
|
||||
string(APPEND out a)
|
||||
if(NOT out STREQUAL "a")
|
||||
message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
set(out x)
|
||||
string(APPEND out a)
|
||||
if(NOT out STREQUAL "xa")
|
||||
message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
|
||||
set(out x)
|
||||
string(APPEND out a "b")
|
||||
if(NOT out STREQUAL "xab")
|
||||
message(FATAL_ERROR "\"string(APPEND out a \"b\")\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
set(b)
|
||||
set(out x)
|
||||
string(APPEND out ${b})
|
||||
if(NOT out STREQUAL "x")
|
||||
message(FATAL_ERROR "\"string(APPEND out \${b})\" set out to \"${out}\"")
|
||||
endif()
|
||||
|
||||
set(b b)
|
||||
set(out x)
|
||||
string(APPEND out a "${b}" [[
|
||||
${c}]])
|
||||
if(NOT out STREQUAL "xab\${c}")
|
||||
message(FATAL_ERROR "\"string(APPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"")
|
||||
endif()
|
||||
1
Tests/RunCMake/string/AppendNoArgs-result.txt
Normal file
1
Tests/RunCMake/string/AppendNoArgs-result.txt
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
4
Tests/RunCMake/string/AppendNoArgs-stderr.txt
Normal file
4
Tests/RunCMake/string/AppendNoArgs-stderr.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
CMake Error at AppendNoArgs.cmake:1 \(string\):
|
||||
string sub-command APPEND requires at least one argument.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
1
Tests/RunCMake/string/AppendNoArgs.cmake
Normal file
1
Tests/RunCMake/string/AppendNoArgs.cmake
Normal file
@@ -0,0 +1 @@
|
||||
string(APPEND)
|
||||
@@ -1,5 +1,8 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(Append)
|
||||
run_cmake(AppendNoArgs)
|
||||
|
||||
run_cmake(Concat)
|
||||
run_cmake(ConcatNoArgs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user