mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
Program names containing '-' (for example, renaming hello to hello-world via PROGNAME) previously generated an invalid identifier <NAME>_main when constructing the main= compiler definition and the APP_MAIN target property used during builtin list generation. This caused the CMake build to fail because '-' is not a valid character in a C identifier. This mirrors the Make-based fix (Application.mk's PROGSYM) for the traditional build. Introduce NAME_SYM, a sanitized copy of NAME with '-' replaced by '_', and use it only where an internal C identifier is required: the main= COMPILE_DEFINITIONS property and the APP_MAIN target property. Leave NAME unchanged everywhere else, including CMake target/output names and the APP_NAME property, where hyphens are valid. The standalone/loadable executable path (MODULE/DYNLIB/kernel build) does not rename main() and therefore requires no sanitization because each executable is linked independently rather than merged into a shared builtin image. Testing (WSL2 Ubuntu, x86_64): - BOARD_CONFIG=sim/nsh, CONFIG_EXAMPLES_HELLO_PROGNAME="hello-world": clean CMake configure/build; 'hello-world' runs and prints 'Hello, World!!' - Reverted to CONFIG_EXAMPLES_HELLO_PROGNAME="hello": reconfigured and rebuilt; 'hello' runs and prints 'Hello, World!!' (no regression) Fixes #19447 Signed-off-by: Ansh Rai <anshrai331@gmail.com> |
||
|---|---|---|
| .. | ||
| menuconfig.cmake | ||
| nuttx_3rdparty.cmake | ||
| nuttx_add_application.cmake | ||
| nuttx_add_dependencies.cmake | ||
| nuttx_add_library.cmake | ||
| nuttx_add_module.cmake | ||
| nuttx_add_romfs.cmake | ||
| nuttx_add_subdirectory.cmake | ||
| nuttx_add_symtab.cmake | ||
| nuttx_create_symlink.cmake | ||
| nuttx_export_header.cmake | ||
| nuttx_extensions.cmake | ||
| nuttx_generate_headers.cmake | ||
| nuttx_generate_outputs.cmake | ||
| nuttx_generate_sim_ld.cmake | ||
| nuttx_kconfig.cmake | ||
| nuttx_mkconfig.cmake | ||
| nuttx_mkversion.cmake | ||
| nuttx_multiple_link.cmake | ||
| nuttx_overrides.cmake | ||
| nuttx_parse_function_args.cmake | ||
| nuttx_process_config.cmake | ||
| nuttx_redefine_symbols.cmake | ||
| nuttx_remove_compile_options.cmake | ||
| nuttx_sethost.cmake | ||
| nuttx_source_file_properties.cmake | ||
| nuttx_toolchain.cmake | ||
| savedefconfig.cmake | ||
| symtab.c.in | ||