CMake
is missing a lot of helper functions when it comes to collections.
However using the list
function that CMake
provides it is possible to add alot of functions that help the developer.
- encoded_list
- encoded_list_append
- encoded_list_decode
- encoded_list_get
- encoded_list_peek_back
- encoded_list_peek_front
- encoded_list_pop_back
- encoded_list_pop_front
- encoded_list_remove_at
- encoded_list_remove_item
- encoded_list_set
- encoded_list_to_cmake_string
- is_encoded_list
- index_range
- linked_list_insert_after
- linked_list_insert_before
- linked_list_new
- linked_list_node_new
- linked_list_peek_back
- linked_list_peek_front
- linked_list_pop_back
- linked_list_pop_front
- linked_list_push_back
- linked_list_push_front
- linked_list_remove
- linked_list_replace
- list_after
- list_all
- list_any
- list_at
- list_before
- list_check_items
- list_combinations
- list_contains
- list_contains_any
- list_count
- list_equal
- list_erase
- list_erase_slice
- list_except
- list_extract
- list_extract_any_flag
- list_extract_any_labelled_value
- list_extract_flag
- list_extract_flags
- list_extract_flag_name
- list_extract_labelled_keyvalue
- list_extract_labelled_value
- list_extract_matches
- list_find
- list_find_any
- list_find_flags
- list_fold
- list_get
- list_get_labelled_value
- list_get_lean
- list_intersect
- list_intersect_args
- list_isempty
- list_isinorder
- list_iterator
- list_iterator_break
- list_iterator_next
- list_length
- list_max
- list_modify
- list_normalize_index
- list_parse_descriptor
- list_peek_back
- list_peek_front
- list_pop_back
- list_pop_front
- list_push_back
- list_push_front
- list_regex_match
- list_regex_match_ignore
- list_remove
- list_remove_at
- list_remove_duplicates
- list_replace_at
- list_replace_slice
- list_reverse
- list_select
- list_select_property
- list_set_at
- list_slice
- list_sort
- list_split
- list_split_at
- list_swap
- list_to_map
- list_to_string
- list_union
- list_unique
- list_where
- list_without_range
- is_range
- list_range_get
- list_range_indices
- list_range_partial_write
- list_range_remove
- list_range_replace
- list_range_set
- list_range_try_get
- range_from_indices
- range_indices
- range_indices_valid
- range_instanciate
- range_parse
- range_partial_unpack
- range_simplify
- set_difference
- set_isequal
- set_issubset
- structured_list_parse
- list_structure_print_help
comapres two lists with each other usage list_equal( 1 2 3 4 1 2 3 4) list_equal( listA listB) list_equal( ${listA} ${listB}) ... COMPARATOR defaults to STREQUAL COMPARATOR can also be a lambda expression COMPARATOR can also be EQUAL
removes the specified range from lst the start_index is inclusive and end_index is exclusive
removes the specified range from lst and returns the removed elements
return those elemnents of minuend that are not in subtrahend
extracts elements from the list example set(lst 1 2 ) list_extract(lst a b c) a contains 1 b contains 2 c contains nothing returns the rest of list
extracts all of the specified flags and returns true if any of them were found
extracts a single flag from a list returning true if it was found false otherwise. if flag exists multiple time online the first instance of the flag is removed from the list
extracts all flags specified and returns a map with the key being the flag name if it was found and the value being set to tru e.g. list_extract_flags([a,b,c,d] a c e) -> {a:true,c:true}, [b,d]
searchs for label in lst. if label is found the label and its following value is removed and returned if label is found but no value follows ${ARGN} is returned if following value is enclosed in [] the brackets are removed this allows mulitple values to be returned ie list_extract_labelled_value(lstA --test1) if lstA is a;b;c;--test1;[1;3;4];d the function returns 1;3;4
searchs lst for value and returns the first idx found returns -1 if value is not found
folds the specified list into a single result by recursively applying the aggregator
returns a list containing all elemmtns contained in all passed list references
returns only those flags which are contained in list and in the varargs ie list = [--a --b --c --d] list_intersect_args(list --c --d --e) -> [--c --d]
checks if the given list reference is an empty list
returns true if value ${a} comes before value ${b} in list __list_isinorder_lst sets ${result} to true or false
returns the normalized index. negative indices are transformed to i => length - i if the index is out of range after transformation -1 is returned and a warnign is issued note: index evaluating to length are valid (one behind last)
returns true if value could be parsed
gets the first element of the list without modififying it
removes the last element from list and returns it
removes the first value of the list and returns it
adds a value to the end of the list
adds a value at the beginning of the list
removes all items specified in varargs from list returns the number of items removed
removes all items at all specified indices from list
replaces lists value at i with new_value
uses the selector on each element of the list
sets the lists value at index to the specified value the index is normalized -> negativ indices count down from back of list
retruns a portion of the list specified. negative indices count from back of list
orders a list by a comparator function
swaps the element of lst at i with element at index j
Converts a CMake list to a string containing elements separated by spaces
returns a list containing the unqiue set of all elements contained in passed list referencese
takes the passed list and returns only its unique elements see cmake's list(REMOVE_DUPLICATES)
executes a predicate on every item of the list (passed by reference) and returns those items for which the predicate holds
removes the specifed range from the list and returns remaining elements
retruns true iff lhs and rhs are the same set (ignoring duplicates) the null set is only equal to the null set the order of the set (as implied in being a set) does not matter
returns true iff lhs is subset of rhs duplicate elements in lhs and rhs are ignored the null set is subset of every set including itself no other set is subset of the null set if rhs contains all elements of lhs then lhs is the subset of rhs
parses a structured list given the structure map returning a map which contains all the parsed values