import re


def fill_CMake_lists(cmake_contents, example_name, extra_names, vtk_modules, web_repo_url):
    """
    Fill in the template parameters in a CMakeLists template file.
    The output is a CMakeLists.txt file with Name substituted for {{{1}}}
    :param cmake_contents: The template file.
    :param example_name: The example file name.
    :param extra_names: Any needed extra files needed to build the example.
    :param vtk_modules: The VTK modules e.g. vtkCommonCore ... in a string.
    :param web_repo_url: The web repository URL.
    :return: A CMakeLists.txt file.
    """
    r1 = re.sub(r'WWW', web_repo_url, cmake_contents)
    r2 = re.sub(r'XXX', example_name.stem, r1)
    r3 = re.sub(r'YYY', extra_names, r2)
    r4 = re.sub(r'ZZZ', vtk_modules, r3)
    return r4