[libc] Use response files for hdrgen entry points (#183267)

This avoids the build failure when the command line ends up being too
long which can be especially problematic on Windows.

Fixes #182374
This commit is contained in:
Petr Hosek 2026-02-26 00:42:17 -08:00 committed by GitHub
parent 5dd160058f
commit c5339b7025
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -109,7 +109,10 @@ function(add_gen_header target_name)
set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
endif()
# TODO: Use $<LIST:PREPEND,list,item,...> after we bump CMake to 3.27.
list(TRANSFORM entry_points PREPEND "--entry-point=")
set(rsp_file "${CMAKE_CURRENT_BINARY_DIR}/${relative_path}.rsp")
file(GENERATE OUTPUT ${rsp_file} CONTENT "$<JOIN:${entry_points},\n>")
add_custom_command(
OUTPUT ${out_file}
@ -119,9 +122,9 @@ function(add_gen_header target_name)
--depfile ${dep_file}
--write-if-changed
${proxy_arg}
${entry_points}
${yaml_file}
DEPENDS ${yaml_file}
"@${rsp_file}"
DEPENDS ${yaml_file} ${rsp_file}
DEPFILE ${dep_file}
COMMENT "Generating header ${ADD_GEN_HDR_GEN_HDR} from ${yaml_file}"
)

View File

@ -18,7 +18,9 @@ from hdrgen.yaml_to_classes import load_yaml_file, fill_public_api
def main():
parser = argparse.ArgumentParser(description="Generate header files from YAML")
parser = argparse.ArgumentParser(
description="Generate header files from YAML", fromfile_prefix_chars="@"
)
parser.add_argument(
"yaml_file",
help="Path to the YAML file containing header specification",