diff --git a/data/generators/generate-cmake-syntax.py b/data/generators/generate-cmake-syntax.py --- a/data/generators/generate-cmake-syntax.py +++ b/data/generators/generate-cmake-syntax.py @@ -33,6 +33,7 @@ , 'install-properties' ] _KW_RE_LIST = ['kw', 're'] +_VAR_KIND_LIST = ['variables', 'environment-variables'] def try_transform_placeholder_string_to_regex(name): @@ -44,6 +45,9 @@ if 'CMAKE_MATCH_' in m: return '\\bCMAKE_MATCH_[0-9]+\\b' + if 'CMAKE_ARGV' in m: + return '\\bCMAKE_ARGV[0-9]+\\b' + return '\\b{}\\b'.format('&id_re;'.join(list(m))) if 1 < len(m) else name @@ -109,34 +113,43 @@ def cli(input_yaml, template): data = yaml.load(input_yaml) - # Partition `variables` list into "pure" words and regexes to match - data['variables'] = { - k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [*partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data['variables'])]) - } - data['variables']['re'] = [*map(lambda x: try_transform_placeholder_string_to_regex(x), data['variables']['re'])] - - # Partition `environment-variables` list into "pure" words and regexes to match - data['environment-variables'] = { - k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [*partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data['environment-variables'])]) - } - data['environment-variables']['re'] = [*map(lambda x: try_transform_placeholder_string_to_regex(x), data['environment-variables']['re'])] - + # Partition `variables` and `environment-variables` lists into "pure" (key)words and regexes to match + for var_key in _VAR_KIND_LIST: + data[var_key] = { + k: sorted(set(v)) for k, v in zip( + _KW_RE_LIST + , [*partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data[var_key])] + ) + } + data[var_key]['re'] = [ + *map( + lambda x: try_transform_placeholder_string_to_regex(x) + , data[var_key]['re'] + ) + ] # Transform properties and make all-properties list data['properties'] = {} for prop in _PROPERTY_KEYS: python_prop_list_name = prop.replace('-', '_') props, props_re = partition_iterable(lambda x: _TEMPLATED_NAME.search(x) is None, data[prop]) del data[prop] - data['properties'][python_prop_list_name] = {k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [props, props_re])} - data['properties'][python_prop_list_name]['re'] = [*map(lambda x: try_transform_placeholder_string_to_regex(x), props_re)] - + data['properties'][python_prop_list_name] = { + k: sorted(set(v)) for k, v in zip(_KW_RE_LIST, [props, props_re]) + } + data['properties'][python_prop_list_name]['re'] = [ + *map(lambda x: try_transform_placeholder_string_to_regex(x), props_re) + ] data['properties']['kinds'] = [*map(lambda name: name.replace('-', '_'), _PROPERTY_KEYS)] # Make all commands list - data['commands'] = [*map(lambda cmd: transform_command(cmd), data['scripting-commands'] + data['project-commands'] + data['ctest-commands'])] + data['commands'] = [ + *map( + lambda cmd: transform_command(cmd) + , data['scripting-commands'] + data['project-commands'] + data['ctest-commands']) + ] # Fix node names to be accessible from Jinja template data['generator_expressions'] = data['generator-expressions'] diff --git a/data/syntax/cmake.xml b/data/syntax/cmake.xml --- a/data/syntax/cmake.xml +++ b/data/syntax/cmake.xml @@ -31,7 +31,7 @@ CMAKE_AR CMAKE_ARCHIVE_OUTPUT_DIRECTORY CMAKE_ARGC - CMAKE_ARGV0 CMAKE_AUTOGEN_ORIGIN_DEPENDS CMAKE_AUTOGEN_PARALLEL CMAKE_AUTOGEN_VERBOSE @@ -1488,6 +1487,7 @@ CMAKE_REQUIRED_FLAGS CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES + CMAKE_REQUIRED_LINK_OPTIONS CMAKE_REQUIRED_QUIET CMAKE_ROOT CMAKE_RUNTIME_OUTPUT_DIRECTORY @@ -3739,6 +3739,7 @@ + @@ -3847,6 +3848,7 @@ + @@ -3966,9 +3968,10 @@ + - + diff --git a/generators/cmake.xml.tpl b/generators/cmake.xml.tpl --- a/generators/cmake.xml.tpl +++ b/generators/cmake.xml.tpl @@ -31,7 +31,7 @@ + - + diff --git a/generators/cmake.yaml b/generators/cmake.yaml --- a/generators/cmake.yaml +++ b/generators/cmake.yaml @@ -534,7 +534,7 @@ # Variables that Provide Information - CMAKE_AR - CMAKE_ARGC - - CMAKE_ARGV0 + - CMAKE_ARGV - CMAKE_BINARY_DIR - CMAKE_BUILD_TOOL - CMAKE_CACHEFILE_DIR @@ -1133,6 +1133,7 @@ - CMAKE_REQUIRED_DEFINITIONS - CMAKE_REQUIRED_FLAGS - CMAKE_REQUIRED_INCLUDES + - CMAKE_REQUIRED_LINK_OPTIONS # Since 3.14 - CMAKE_REQUIRED_LIBRARIES - CMAKE_REQUIRED_QUIET # - CheckTypeSize