{"id":19320220,"url":"https://github.com/widberg/cmake-toolchain-example","last_synced_at":"2026-03-19T09:15:53.776Z","repository":{"id":136103675,"uuid":"510483798","full_name":"widberg/cmake-toolchain-example","owner":"widberg","description":"A simple example of how to use CMake's toolchain functionality to build and use Clang for a Windows target from a foreign host.","archived":false,"fork":false,"pushed_at":"2022-07-05T00:08:33.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T23:41:33.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/widberg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-07-04T19:41:25.000Z","updated_at":"2025-08-04T21:13:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"e6081605-7955-48a1-a785-c70e43038beb","html_url":"https://github.com/widberg/cmake-toolchain-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/widberg/cmake-toolchain-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widberg%2Fcmake-toolchain-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widberg%2Fcmake-toolchain-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widberg%2Fcmake-toolchain-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widberg%2Fcmake-toolchain-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/widberg","download_url":"https://codeload.github.com/widberg/cmake-toolchain-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/widberg%2Fcmake-toolchain-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29928260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-10T01:27:53.841Z","updated_at":"2026-02-28T08:09:50.187Z","avatar_url":"https://github.com/widberg.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMake Toolchain Example\n\nThis repository is a simple example of how to use CMake's toolchain functionality to build and use Clang for a Windows target from a foreign host.\n\nFor a more complex example that is still easy to understand check out [SerenityOS](https://github.com/SerenityOS/serenity/tree/master/Toolchain).\n\nNote: Using the Visual Studio generator will not work since it [silently ignores the toolchain file settings for CMAKE_C_COMPILER and CMAKE_CXX_COMPILER](https://gitlab.kitware.com/cmake/cmake/-/issues/23385). I recommend using the Ninja generator.\n\n## Getting Started\n\n### Checkout\n\n```sh\ngit clone https://github.com/widberg/cmake-toolchain-example.git --recursive --shallow-submodules\ncd cmake-toolchain-example\n```\n\n### Build\n\nYou need to re-configure the build from scratch when the toolchain file changes.\n\n```sh\nmkdir build\ncd build\ncmake .. -GNinja\ncmake --build .\n```\n\n### Run\n\n```sh\nD:\\cmake-toolchain-example\\build\u003eexample.exe\nHello, World! (14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1))\n```\n\nYou can see that regardless of which compiler was initially used on the foreign host, the built Clang toolchain was used to compile the executable for Windows.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwidberg%2Fcmake-toolchain-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwidberg%2Fcmake-toolchain-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwidberg%2Fcmake-toolchain-example/lists"}