The string() Command

Let's learn about the string() command in CMake.

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

  • JSON operations (the last one available since CMake 3.19)

Full details can be found in the online documentation.

string() modes that accept the <input> argument will accept multiple <input> values and concatenate them before the execution of the command:

Get hands-on with 1200+ tech skills courses.