{"id":46859156,"url":"https://github.com/jmacheta/cubemx-cmake","last_synced_at":"2026-03-10T17:49:17.591Z","repository":{"id":151067248,"uuid":"602149869","full_name":"jmacheta/cubemx-cmake","owner":"jmacheta","description":"CMake instrumentation for STM32CubeMX","archived":false,"fork":false,"pushed_at":"2024-04-10T13:37:23.000Z","size":87,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-10T20:06:32.577Z","etag":null,"topics":["cmake","cmake-scripts","cubemx","stm32"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmacheta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-02-15T15:47:50.000Z","updated_at":"2024-01-16T21:41:15.000Z","dependencies_parsed_at":"2024-04-08T15:05:55.963Z","dependency_job_id":null,"html_url":"https://github.com/jmacheta/cubemx-cmake","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jmacheta/cubemx-cmake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmacheta%2Fcubemx-cmake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmacheta%2Fcubemx-cmake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmacheta%2Fcubemx-cmake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmacheta%2Fcubemx-cmake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmacheta","download_url":"https://codeload.github.com/jmacheta/cubemx-cmake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmacheta%2Fcubemx-cmake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30345839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmake","cmake-scripts","cubemx","stm32"],"created_at":"2026-03-10T17:49:16.980Z","updated_at":"2026-03-10T17:49:17.580Z","avatar_url":"https://github.com/jmacheta.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMake instrumentation for STM32 CubeMX\n\nThis package provides CMake cross-platform instrumentation STM32 CubeMX application.\nIts main intent is to automate CMake library generation from CubeMX project files (.ioc), to reduce unnecessary clutter in repositories that simply use STM32HAL.\n\nThe package provides flexible way of defining, which components of generated code to use (start code, compiler definitions, linker script).\n\n## Installation\n\nThe easiest way is to use built-in CMake FetchContent:\n\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(cubemx_cmake URL https://github.com/jmacheta/cubemx-cmake/tarball/latest)\nFetchContent_MakeAvailable(cubemx_cmake)\n```\n\nAlternatively, you can add this repo as a submodule, and simply use ```add_subdirectory(\u003cpath_to_cubemx_cmake_in_your_tree\u003e)```\n\n## Example Usage\n\n\u003e **NOTE**\n\u003e This script will look for CubeMX executable in PATH, and default install directories.\n\u003e If you have installed CubeMX in different directory, set either environment variable CUBEMX_DIR, or cmake variable BEFORE FetchContent_MakeAvailable\n\n```cmake\ncubemx_add_library(\u003cpath_to_ioc_file\u003e) ## eg. C:/my_hardware.ioc, my_hardware.ioc (assuming it exists in current source dir), or simply my_hardware (.ioc file extension is assumed)\n\n# Add some application to link with.\nadd_executable(my_app main.cpp) \n\n# Link application with generated files from CubeMX. The generated library will have the same name as the .ioc file (unless you use advanced options. See API reference).\n# my_hardware target has public dependency to generated LDSCRIPT, and provides generated C defines (unless you use advanced options. See API reference again).\ntarget_link_libraries(my_app PRIVATE my_hardware)\n\n```\n\n## API Reference\n\n```\nGenerate CubeMX project from .ioc file, then add a library target\n\n    cubemx_add_library(\u003cname\u003e)\n\nAdd a library target from existing CubeMX-generated Makefile\n\n    cubemx_add_library_from(\u003cname\u003e \u003cmakefile_path\u003e)\n\nGenerate CubeMX project\n\n    cubemx_generate(\u003cgenerate_script_path\u003e)\n```\n\nBasic signature:\n\n```cmake\ncubemx_add_library(\u003cTargetName\u003e)\n```\n\nThe basic signature assumes that the name of the target to generate is the same as the name of CubeMX configuration file, and it exists in current source directory. If so, The function will generate the code using CubeMX, and create Cmake OBJECT library with all sources, compile definitions, and LDSCRIPT.\n\nRegardless of the mode used, a .cmake_generated file will be created in the destination directory, that allows skipping generation step when both .ioc file and generated Makefile did not change.\n\nFull signature:\n\n```cmake\ncubemx_add_library(\u003cTargetName\u003e [CONFIG_FILE \u003cpath\u003e] [DESTINATION \u003cpath\u003e]\n    [NO_STARTUP]\n    [NO_LDSCRIPT]\n    [FORCE]\n    [ADDITIONAL_COMMANDS command1 [command2 ...]]\n)\n```\n\nThe ```CONFIG_FILE``` option specifies path to .ioc file. It is useful when you want to specify ```TargetName``` that differs from the config file name.\nIf relative path is used, it is assumed that it is relative to ```CMAKE_CURRENT_SOURCE_DIR```\n\nThe code will be generated in \u003cconfig_file_directory\u003e directory. If different destination is needed, ```DESTINATION``` option should specify required directory. If relative path is used, it is assumed that it is relative to ```CMAKE_CURRENT_SOURCE_DIR```\n\nGenerated target will enforce linking with generated LDSCRIPT unless ```NO_LDSCRIPT``` option is provided.\n\nIf it is desired to execute code generation every time CMake is configures, use ```FORCE``` option.\n\nBy using ```ADDITIONAL_COMMANDS``` it is possible to customize CubeMX generation script: pass command sequence as consecutive arguments\n\n\n```cmake\ncubemx_add_library_from(\u003cname\u003e \u003cmakefile_path\u003e [NO_LDSCRIPT] [NO_STARTUP] [NO_DEFS])\n```\nAdds a library target from existing Makefile. This function Does Not look for CubeMX instance, so might be useful when none is present.\nThe other options do the same as in ```cubemx_add_library```\n\n\n\n## Limitations\n\nBy desing I only support CubeMX Makefile projects. If provided .ioc file uses different generator, it will be overriden (see cubemx_generate_script)\n\nCurrently I don't see a need to support generating executable targets - If you need to create exec, create a dummy file and link with the generated library:\n\n```cmake\nfile(TOUCH dummy.c)\nadd_executable(my_exec dummy.c)\ntarget_link_libraries(my_exec my_generated_library)\n```\n\nIf you think, that separate executable function should be implemented, feel free to contact me ;)\n\n## Non-Affiliation Disclaimer\n\nThis package is not endorsed by, directly affiliated with, maintained, authorized, or sponsored by STMicroelectronics. All product and company names are the registered trademarks of their original owners. The use of any trade name or trademark is for identification and reference purposes only and does not imply any association with the trademark holder of their product brand.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmacheta%2Fcubemx-cmake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmacheta%2Fcubemx-cmake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmacheta%2Fcubemx-cmake/lists"}