############################### cmakepp_lang/algorithm/contains ############################### .. module:: cmakepp_lang/algorithm/contains .. function:: cpp_contains(result item list) Determines if an element appears in a set-like object. This function is meant to function like Python's ``in`` operation. Basically it encapsulates the process of checking if ``x`` is in ``y``. What "is in" means depends on the types of ``x`` and ``y``. For example if ``y`` is a list, then "is in" checks to see if ``x`` is an item in that list. Alternatively if ``y`` is a string then this function will check if ``x`` is a substring of ``y``. :param result: Name for the variable to hold the result. :type result: desc :param item: The item whose inclusion in ``list`` is in question. :type item: str :param list: The collection we are looking for ``item`` in. :type list: str :returns: ``result`` will be set to ``TRUE`` if ``item`` is in ``list`` and ``FALSE`` otherwise. :rtype: bool :var CMAKEPP_LANG_DEBUG_MODE: Used to determine if CMakePP is being run in debug mode or not. :vartype CMAKEPP_LANG_DEBUG_MODE: bool Example Usage ============= The following snippet shows how to determine if the word ``"hello"`` is in the list ``"hello;world"``. .. code-block:: cmake include(cmakepp_lang/logic/contains) set(a_list "hello" "world") cpp_contains(result "hello" "${a_list}") message("The list contains 'hello': ${result}") # Will print TRUE Error Checking ============== If CMakePP is run in debug mode this function will ensure that it is called with the correct number of arguments and that those arguments have the correct types. These error checks are only performed if CMakePP is run in debug mode.