cmakepp_lang/types/bool
- cmakepp_lang/types/bool.cpp_is_bool(return str2check)
Determines if the provided string can lexically be cast to a boolean.
This function will compare the provided string against the list of boolean literals known to CMakePP. The actual string comparison is done in a case-insensitive manner.
- Parameters:
return (desc) – Name of the variable used to hold the return.
str2check (str) – The string we are checking for its bool-ness
- Returns:
return
will containTRUE
ifstr2check
is one of the recognized boolean literals andFALSE
otherwise.- Return type:
bool
- Variables:
CMAKEPP_BOOL_LITERALS – Used to get the list of boolean literals.
Example Usage
The following code snippet shows how to use
cpp_is_bool
to determine if the provided variable is a boolean.include(cmakepp_lang/types/bool) set(var2check TRUE) cpp_is_bool(result "${var2check}") message("var2check is a bool: ${result}") # will print TRUE
Error Checking
cpp_is_bool
will ensure that it has been called with exactly two arguments.