{"id":21995814,"url":"https://github.com/lb--/findmypackage.cmake","last_synced_at":"2026-03-19T21:30:10.441Z","repository":{"id":148327989,"uuid":"49792749","full_name":"LB--/FindMyPackage.cmake","owner":"LB--","description":"CMake Find Package script that you only need to rename. It supports multiple versions and components too!","archived":false,"fork":false,"pushed_at":"2016-08-17T22:58:33.000Z","size":19,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"cmake","last_synced_at":"2025-10-12T07:34:46.271Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LB--.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":"2016-01-16T22:01:37.000Z","updated_at":"2023-09-08T17:05:55.000Z","dependencies_parsed_at":"2023-05-19T19:45:19.197Z","dependency_job_id":null,"html_url":"https://github.com/LB--/FindMyPackage.cmake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LB--/FindMyPackage.cmake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2FFindMyPackage.cmake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2FFindMyPackage.cmake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2FFindMyPackage.cmake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2FFindMyPackage.cmake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LB--","download_url":"https://codeload.github.com/LB--/FindMyPackage.cmake/tar.gz/refs/heads/cmake","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LB--%2FFindMyPackage.cmake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29288507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T21:57:15.303Z","status":"ssl_error","status_checked_at":"2026-02-09T21:57:11.537Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2024-11-29T21:18:42.877Z","updated_at":"2026-02-10T01:34:16.443Z","avatar_url":"https://github.com/LB--.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"FindMyPackage.cmake [![travis](https://travis-ci.org/LB--/FindMyPackage.cmake.svg?branch=cmake)](https://travis-ci.org/LB--/FindMyPackage.cmake)\n===================\n\nThis is my personal CMake FindPackage script template - it handles having multiple versions installed and it doesn't require any modification for my purposes other than changing the filename.\nYou can use it for your purposes too!\nSimply change the filename to `Find\u003cname of your package\u003e.cmake` and make sure your install script puts things in the right places.\nYou need to use a versioned directory structure for your installation, with a package config file stored at a location like `MyPackage/3.14.159/cmake/MyPackage.cmake`.\nComponents are also supported, just put their package config files at a location like `MyPackage/3.14.159/cmake/MyPackage/Component.cmake`.\n\n`MyPackage_ROOT` can be set before calling `find_package` to help with finding the desired location, otherwise it will be found automatically if it is in a standard location.\nWithin the `MyPackage_ROOT` directory, there should be a directory named `MyPackage`, and within that directory should be directories named after the versions they contain (e.g. 3.14.159).\nWithin each version directory is a typical installation tree with directories such as `cmake`, `include`, `lib`, `bin`, etc.\n\nThere is support for rich version matching - for example, `find(MyPackage 2 EXACT)` will find the highest version with a major version of 2, whereas `find(MyPackage 3.14)` will find the highest available version where the major version number is _at least_ 3 and, if the major version equals 3, the minor version number is _at least_ 14.\nAll CMake-style versions are supported - that is, versions in the format `major[.minor[.patch[.tweak]]]`.\nAlthough you can have different depths for each version, I recommend that you use the same depth for all versions to avoid confusion.\nWhen requesting optional components, only the version(s) with the most requested optional components are considered (so a lower version may be selected if it has more of the desired optional components).\nObviously, versions that are missing requsted required components are not considered at all.\n\n## What if my package has `::` in it?\nThat's great! You can have a slash in your package name and the 'friendly name' will replace the slashes with double colons.\nFor example, for my library `LB::events`, I create a directory named `FindLB` and within it place this file named as `events.cmake`.\nThen users can use `find_package(LB/events)` and it will work, whilst the package name displayed in the output is `LB::events`.\nAnd yes, CMake variable names can contain slashes - `${LB/events_FOUND}` will indicate whether my package is found.\nThe script will find and include my package config file at a path like `LB/events/3.14.159/cmake/LB/events.cmake` and it is expected that this will introduce an imported target named `LB::events`.\n\n## Variables\nRmemeber: CMake variable names are case sensitive.\nIf your package is named `CamelCasePackage`, then you will need to listen for `${CamelCasePackage_FOUND}` with the same case.\n\n### Input Variables\nAll input variables are optional.\n* `\u003cpackage\u003e_ROOT` - the directory containing the start of the directory tree (should contain a folder named `\u003cpackage\u003e`)\n* `\u003cpackage\u003e_PREFER_HIGHEST` - instead of selecting a lower version with more of the requested optional components, prefer selecting the highest version even if it has fewer requested optional components\n\n### Output Variables\n* `\u003cpackage\u003e_FOUND` - 1 if found, unset otherwise.\n* `\u003cpackage\u003e_\u003ccomponent\u003e_FOUND` - 1 if the requested component was found, unset otherwise.\n* `\u003cpackage\u003e_NOT_FOUND_MESSAGE` - the error message if the package was not found\n* `\u003cpackage\u003e_ROOT` - the directory containing the start of the directory tree (contains a folder named `\u003cpackage\u003e`)\n* `\u003cpackage\u003e_ROOT_DIR` - path to the selected installation (contains the version number in the path)\n* `\u003cpackage\u003e_VERSIONS_DIRECTORY` - path to the directory containing the version directories\n* `\u003cpackage\u003e_VERSIONS` - ;-list of all versions that were considered\n* `\u003cpackage\u003e_VERSION` - the selected version\n* `\u003cpackage\u003e_VERSION_STRING` - same as `\u003cpackage\u003e_VERSION`\n* `\u003cpackage\u003e_VERSION_MAJOR`\n* `\u003cpackage\u003e_VERSION_MINOR`\n* `\u003cpackage\u003e_VERSION_PATCH`\n* `\u003cpackage\u003e_VERSION_TWEAK`\n\n## Example Usages\n* [LB::events](https://github.com/LB--/events/blob/events/events/CMakeLists.txt#L7) - typical library with dependencies\n* [LB::optional](https://github.com/LB--/optional/blob/optional/CMakeLists.txt#L7) - header only library w/o dependencies\n* [LB::tuples](https://github.com/LB--/tuples/blob/tuples/CMakeLists.txt#L7) - header only library w/o dependencies\n* [LB::cloning](https://github.com/LB--/cloning/blob/cloning/CMakeLists.txt#L7) - header only library w/o dependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flb--%2Ffindmypackage.cmake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flb--%2Ffindmypackage.cmake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flb--%2Ffindmypackage.cmake/lists"}