cmakepp_lang/utilities/sanitize_string

cmakepp_lang/utilities/sanitize_string.cpp_sanitize_string(result input)

Converts the input string into a uniform, filesystem-safe string.

Strings in CMake are case-sensitive in some contexts and case-insensitive in others. This function encapsulates the logic for converting a string to a common case (currently lower case because most CMake conventions favor it) and also replacing potentially troublesome characters in the string. The resulting “sanitized” string is suitable for use as a key in a map, part of a variable’s name, or a C/C++ function name.

Parameters:
  • result (desc) – Name for variable which will hold the result.

  • input (str) – The string we are sanitizing.

Returns:

result will be set to the sanitized string.

Return type:

str