{"id":22128658,"url":"https://github.com/xaymar/cmake-clang","last_synced_at":"2025-06-11T19:37:29.124Z","repository":{"id":55803315,"uuid":"234881771","full_name":"Xaymar/cmake-clang","owner":"Xaymar","description":"Clang Toolset integration for CMake. Run clang-format and clang-tidy directly from your project as a target","archived":false,"fork":false,"pushed_at":"2024-02-14T04:07:39.000Z","size":27,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T12:13:51.502Z","etag":null,"topics":["clang","clang-format","clang-tidy","cmake","cmake-module","cmake-modules","llvm"],"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/Xaymar.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,"publiccode":null,"codemeta":null}},"created_at":"2020-01-19T10:32:17.000Z","updated_at":"2025-01-20T03:01:01.000Z","dependencies_parsed_at":"2024-12-01T17:56:56.706Z","dependency_job_id":null,"html_url":"https://github.com/Xaymar/cmake-clang","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Xaymar/cmake-clang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xaymar%2Fcmake-clang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xaymar%2Fcmake-clang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xaymar%2Fcmake-clang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xaymar%2Fcmake-clang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xaymar","download_url":"https://codeload.github.com/Xaymar/cmake-clang/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xaymar%2Fcmake-clang/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259325588,"owners_count":22841059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["clang","clang-format","clang-tidy","cmake","cmake-module","cmake-modules","llvm"],"created_at":"2024-12-01T17:46:52.106Z","updated_at":"2025-06-11T19:37:29.103Z","avatar_url":"https://github.com/Xaymar.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clang Toolset integration for all CMake Generators\nAdds clang-tidy and clang-format support for all current CMake generators, such as the Visual Studio and ninja ones. \n\n# Supported Compilers\n* Visual Studio 2017\n* Visual Studio 2019\n* GCC 8\n* GCC 9\n* Clang\n\n# Usage Reference\n### `generate_compile_commands_json([REGEX \u003cfilter\u003e] TARGETS \u003ctarget\u003e[;\u003ctarget\u003e[;...]])`\nGenerates a compile_commands.json for each supported build configuration which is used for various Clang tools. These files use generator expressions if possible, and should contain everything necessary to run other tools.\n\n* `REGEX \u003cfilter\u003e`: Specify a regular expression by which to filter all sources of the given targets. Defaults to `\\.(h|hpp|c|cpp)$`.\n* `TARGETS \u003ctarget\u003e[;\u003ctarget\u003e[;...]]`: Declare for which targets the compile commands database should be created.\n\n### `clang_format([DEPENDENCY] [GLOBAL] [REGEX \u003cfilter\u003e] [VERSION \u003cversion] TARGETS \u003ctarget\u003e[\u003ctarget\u003e[;...]])`\nAdd a `TARGETNAME_CLANG-FORMAT` target to the project which runs clang-format on the project, using whichever `.clang-format` file it finds next to the source. Automatically applies all formatting and can be used as a build step using the DEPENDENCY flag, in order to prevent formatting from not being applied. \n\n* `DEPENDENCY`: Add the `TARGETNAME_CLANG-FORMAT` as a build dependency to the target.\n* `GLOBAL`: Add a `CLANG-FORMAT` target that contains all other clang-format targets that also specified GLOBAL.\n* `REGEX \u003cfilter\u003e`: Specify a regular expression by which to filter all sources of the given targets. Defaults to `\\.(h|hpp|c|cpp)$`.\n* `VERSION \u003cversion\u003e`: Require a minimum Clang Toolset version to run clang-format.\n* `TARGETS \u003ctarget\u003e[;\u003ctarget\u003e[;...]]`: Specify on which targets clang-format is supposed to be run.\n\n### `clang_tidy([DEPENDENCY] [GLOBAL] [REGEX \u003cfilter\u003e] [VERSION \u003cversion] TARGETS \u003ctarget\u003e[\u003ctarget\u003e[;...]])`\nAdd a `TARGETNAME_CLANG-TIDY` target to the project which runs clang-tidy on the project, using whichever `.clang-tidy` file it finds next to the source. Does not apply suggested fixes automatically, and requires the creation of compile command databases for each target.\n\n* `DEPENDENCY`: Add the `TARGETNAME_CLANG-TIDY` as a build dependency to the target.\n* `GLOBAL`: Add a `CLANG-TIDY` target that contains all other clang-tidy targets that also specified GLOBAL.\n* `REGEX \u003cfilter\u003e`: Specify a regular expression by which to filter all sources of the given targets. Defaults to `\\.(h|hpp|c|cpp)$`.\n* `VERSION \u003cversion\u003e`: Require a minimum Clang Toolset version to run clang-tidy.\n* `TARGETS \u003ctarget\u003e[;\u003ctarget\u003e[;...]]`: Specify on which targets clang-tidy is supposed to be run.\n\n# Example Usage\n## Adding clang-format as a dependency and clang-tidy as a normal target\n```\nif(EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Clang/Clang.cmake\")\n\tinclude(\"Clang\")\n  option(ENABLE_CLANG ON)\n  if(ENABLE_CLANG)\n    generate_compile_commands_json(\n      TARGETS ${PROJECT_NAME}\n    )\n    clang_tidy(\n      TARGETS ${PROJECT_NAME}\t\t\n      VERSION 9.0.0\n    )\n    clang_format(\n      TARGETS ${PROJECT_NAME}\n      DEPENDENCY\n      VERSION 9.0.0\n    )\n  endif()\nendif()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaymar%2Fcmake-clang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaymar%2Fcmake-clang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaymar%2Fcmake-clang/lists"}