{"id":15991182,"url":"https://github.com/friendlyanon/cmake-init-use-pkg-config","last_synced_at":"2026-01-19T15:02:05.292Z","repository":{"id":68574041,"uuid":"423014095","full_name":"friendlyanon/cmake-init-use-pkg-config","owner":"friendlyanon","description":"Using a dependency that does not support clients using CMake","archived":false,"fork":false,"pushed_at":"2022-01-24T20:11:04.000Z","size":10,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-08T22:52:03.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/friendlyanon.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":"2021-10-30T23:48:28.000Z","updated_at":"2024-12-03T04:28:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"2ba6fc75-b99b-400c-b8dd-481e8a191ecc","html_url":"https://github.com/friendlyanon/cmake-init-use-pkg-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/friendlyanon/cmake-init-use-pkg-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlyanon%2Fcmake-init-use-pkg-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlyanon%2Fcmake-init-use-pkg-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlyanon%2Fcmake-init-use-pkg-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlyanon%2Fcmake-init-use-pkg-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/friendlyanon","download_url":"https://codeload.github.com/friendlyanon/cmake-init-use-pkg-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friendlyanon%2Fcmake-init-use-pkg-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28572576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T14:39:55.009Z","status":"ssl_error","status_checked_at":"2026-01-19T14:39:01.217Z","response_time":67,"last_error":"SSL_read: 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":[],"created_at":"2024-10-08T05:42:36.346Z","updated_at":"2026-01-19T15:02:05.261Z","avatar_url":"https://github.com/friendlyanon.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-pkg-config\n\nThis project was generated by [cmake-init][1].  \nIt's heavily stripped down to focus on showing how to use a dependency that\ndoes not support clients using CMake.\n\n# The problem\n\nYou are developing a project, which has a dependency that does not support\nclients using CMake. You wish to use it regardless and also make it easy to\ntransitively depend on.\n\nFor this example, [gumbo-parser][2] was chosen, because it has the perfect\ncharacteristics:\n\n* It does not support clients using CMake, but does provide [pkg-config][3]\n  `.pc` files\n* [vcpkg][4] packages this library, but does not install the `.pc` files nor\n  provide an unofficial CMake package (or at least until [this issue][5] is\n  resolved)\n\nThis would be the same problem even if the dependency used CMake, but did not\nsupport clients using CMake. Failure to provide an install interface via a\nCMake package is one way to cause this.\n\n# The solution\n\nWhen faced with a dependency that does not support clients using CMake is when\ndevelopers are forced to write a find module. This repository has such a\nfind module: [`Findgumbo.cmake`](cmake/find/Findgumbo.cmake)\n\nHowever, we do not want to be forced or to force people building this project\nto use that find module if we can help it. For this reason, project code does\nnot directly make use of it and instead it is the responsibility of the person\nconfiguring this project to [provide it](CMakePresets.json#L25) if necessary.\n\nNow we have to consider clients using vcpkg as well. When vcpkg packages\nsomething that does not officially support clients using CMake, they usually\nuse an `unofficial` prefix for the package and target names (see [libuv][6]).\nThis is done so vcpkg is forwards compatible if a package ever starts\nsupporting clients who use CMake. Working around this requires quite a bit of\nelbow grease:\n\n* The package and target names must be configurable\n  * in the [build interface](cmake/variables.cmake#L30)\n  * and the [install interface](cmake/install-config.cmake.in)\n* The dependency's target name used for building must not leak into the install\n  interface, so [hide it](CMakeLists.txt#L37)\n\nThe defaults in the CMake code highlighted above all assume an optimistic\noutcome, e.g. the developer may use presets to simplify his workflow by setting\nthe variables up as necessary, like it is done for the CI of this project.\nPackage managers (the people) are given all the tools to work out the kinks by\njust setting a few variables and there won't be any need to patch anything **in\nthis project**.\n\n# Conclusion\n\nProvide a CMake package, even if you don't use CMake yourself, but if you are\nusing CMake yourself and don't provide a CMake package, you are subjecting your\nclients to the above.\n\n[1]: https://github.com/friendlyanon/cmake-init\n[2]: https://github.com/google/gumbo-parser\n[3]: https://www.freedesktop.org/wiki/Software/pkg-config/\n[4]: https://github.com/microsoft/vcpkg\n[5]: https://github.com/microsoft/vcpkg/issues/21086\n[6]: https://github.com/microsoft/vcpkg/blob/master/ports/libuv/CMakeLists.txt#L83\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriendlyanon%2Fcmake-init-use-pkg-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffriendlyanon%2Fcmake-init-use-pkg-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriendlyanon%2Fcmake-init-use-pkg-config/lists"}