The string() command
The string()
command is used to manipulate strings. It comes with a variety of modes that perform different actions on the string: search and replace, manipulation, comparison, hashing, generation, and JSON operations (the last one available since CMake 3.19).
Full details can be found in the online documentation: https://cmake.org/cmake/help/latest/command/string.html.
Note that string()
modes that accept the <input>
argument will accept multiple <input>
values and concatenate them before the execution of the command, so:
string(PREPEND myVariable "a" "b" "c")
is the equivalent of the following:
string(PREPEND myVariable "abc")
Available string()
modes are search and replace, manipulation, comparison, hashing, generation, and JSON.
Search and replace
The following modes are available:
string(FIND <haystack> <pattern> <out> [REVERSE...