Brad King 4e184a21be 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.
2013-10-21 12:54:20 -04:00

20 lines
573 B
CMake

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()