def build_lines_for_bin(bin_name, link, no_glob, to_link):
    srcs_template = "file( GLOB {} ./*.cpp ./*.c ./*.cxx )"
    add_bin_template = "add_executable( {} ${{{}}} )"

    srcs_name = '{}_SRC'.format(bin_name.upper())

    if no_glob:
        srcs_template = "set( {{}}\n    {}.cpp\n    # Add new source files here\n)".format(bin_name)

    lines = [
        srcs_template.format(srcs_name),
        "",
        add_bin_template.format(bin_name, srcs_name),
    ]

    lines.extend(tf.build_target_link_lines(bin_name, to_link))

    return lines
def build_lines_for_lib(lib_name, no_glob, to_link, lib_type):
    srcs_template = "file( GLOB {} ./*.cpp ./*.c ./*.cxx )"
    add_lib_template = "add_library( {}{} ${{{}}} )"

    srcs_name = '{}_SRC'.format(lib_name.upper())

    if no_glob:
        srcs_template = "set( {{}}\n    {}.cpp\n    # Add new source files here\n)".format(lib_name)

    lines = [
        srcs_template.format(srcs_name),
        "",
        add_lib_template.format(lib_name, lib_type, srcs_name),
        "",
        "add_subdirectory( tests )"
    ]

    lines.extend(tf.build_target_link_lines(lib_name, to_link))

    return lines