## captures the listed variables in the map
function(map_capture map)
    set(__map_capture_args ${ARGN})
    list_extract_flag(__map_capture_args --reassign)
    ans(__reassign)
    list_extract_flag(__map_capture_args --notnull)
    ans(__not_null)
    foreach (__map_capture_arg ${__map_capture_args})
        if (__reassign AND ${__map_capture_arg} MATCHES "(.+)[:=](.+)")
            set(__map_capture_arg_key ${CMAKE_MATCH_1})
            set(__map_capture_arg ${CMAKE_MATCH_2})
        else ()
            set(__map_capture_arg_key "${__map_capture_arg}")
        endif ()
#        print_vars(__map_capture_arg __map_capture_arg_key)
#        print_vars(__not_null)
        if (NOT __not_null OR NOT "${${__map_capture_arg}}_" STREQUAL "_")
            map_set(${map} "${__map_capture_arg_key}" "${${__map_capture_arg}}")
        endif ()
    endforeach ()
endfunction()

