{"id":15136808,"url":"https://github.com/conan-io/cmake-conan","last_synced_at":"2025-04-13T07:23:25.480Z","repository":{"id":10619733,"uuid":"57964869","full_name":"conan-io/cmake-conan","owner":"conan-io","description":"CMake wrapper for conan C and C++ package manager","archived":false,"fork":false,"pushed_at":"2025-03-26T13:27:04.000Z","size":437,"stargazers_count":858,"open_issues_count":220,"forks_count":258,"subscribers_count":33,"default_branch":"develop2","last_synced_at":"2025-04-06T04:02:56.240Z","etag":null,"topics":["c","cmake","cmake-wrapper","conan","cpp","package-manager"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/conan-io.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-05-03T11:40:37.000Z","updated_at":"2025-04-04T16:14:23.000Z","dependencies_parsed_at":"2023-02-13T18:46:19.474Z","dependency_job_id":"c64fb84d-5be8-4ec7-8af5-afd3b196904d","html_url":"https://github.com/conan-io/cmake-conan","commit_stats":{"total_commits":421,"total_committers":87,"mean_commits":4.839080459770115,"dds":0.7790973871733967,"last_synced_commit":"c22bbf0af0b73d5f0def24a9cdf4ce503ae79e5d"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conan-io%2Fcmake-conan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conan-io%2Fcmake-conan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conan-io%2Fcmake-conan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conan-io%2Fcmake-conan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conan-io","download_url":"https://codeload.github.com/conan-io/cmake-conan/tar.gz/refs/heads/develop2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248676554,"owners_count":21143931,"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":["c","cmake","cmake-wrapper","conan","cpp","package-manager"],"created_at":"2024-09-26T06:41:25.536Z","updated_at":"2025-04-13T07:23:25.442Z","avatar_url":"https://github.com/conan-io.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# cmake-conan\n\n![Build Status](https://github.com/conan-io/cmake-conan/actions/workflows/cmake_conan.yml/badge.svg?branch=develop2)\n\nCMake dependency provider for the Conan C and C++ package manager.\n\n\n| ⚠️ Important: Conan 2 is the recommended production version for ``cmake-conan``.  | \n|------------------------------------------|\n| The ``cmake-conan`` integration in this ``develop2`` branch for Conan 2 using CMake dependency providers, even if not released as 1.0 yet, is more stable, production-ready and recommended than the legacy ``cmake-conan`` for Conan 1. Please update to Conan 2 and the new ``cmake-conan`` integration in this ``develop2`` branch. |\n\n\n## Quickstart with Conan 2.0\n\nPrerequisites:\n* CMake 3.24\n* Conan 2.0.5\n* A CMake-based project that contains a `conanfile.txt` or `conanfile.py` to list the required dependencies.\n\nFirst, clone this repository in the `develop2` branch.\n\n```bash\ngit clone https://github.com/conan-io/cmake-conan.git -b develop2\n```\n\n### Example project\n\nThis repository contains a `CMakeLists.txt` with an example project that depends on `fmt`. \n\n```bash\ncd cmake-conan/example\nmkdir build\ncmake -B build -S . -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=../conan_provider.cmake -DCMAKE_BUILD_TYPE=Release\ncmake --build build --config Release\n```\n\n### In your own project\n\n* Ensure you have placed a `conanfile.txt` or `conanfile.py` at the root of your project, listing your requirements. You can see [conanfile.txt](example/conanfile.txt) for an example, or check the Conan documentation for `conanfile`: [.txt docs](https://docs.conan.io/2/reference/conanfile_txt.html), [.py docs](https://docs.conan.io/2/reference/conanfile/attributes.html#requirements).\n\n* When first invoking CMake to configure the project, pass `-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=[path-to-cmake-conan]/conan_provider.cmake`. This will ensure that `conan install` is invoked from within CMake. This integration **does not require making any changes to your `CMakeLists.txt` scripts**. \n\n```bash\ncd [your-project]\nmkdir build\ncmake -B build -S . -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=[path-to-cmake-conan]/conan_provider.cmake -DCMAKE_BUILD_TYPE=Release\n```\n\n### Known limitations with Conan 2.0\n\n* Only the `CMakeDeps` generator is specified - for build settings that would otherwise be provided by `CMakeToolchain` (for example, the compiler itself or other global build settings) please invoke Conan separately as per [documentation](https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html).\n* Currently this only works such that Conan can satisfy invocations to CMake's `find_package`. For dependencies that have logic outside of `find_package`, for example, by making direct calls to `find_program`, `find_library`, `find_path` or `find_file`, these may not work correctly.\n* When using a single-configuration CMake generator, you must specify a valid `CMAKE_BUILD_TYPE` (can't be left blank)\n* Deriving Conan settings is currently only supported on the most common platforms with the most popular compilers.\n\n### Customizing Conan profiles\nThe CMake-Conan dependency provider will create a Conan profile where the settings (`os`, `arch`, `compiler`, `build_type`) are retrieved from what CMake has detected for the current build. Conan uses two profiles for dependencies, the _host_ and the _build_ profiles. You can read more about them [here](https://docs.conan.io/2.0/tutorial/consuming_packages/cross_building_with_conan.html?highlight=build%20profile#conan-two-profiles-model-build-and-host-profiles). In CMake-Conan, the default behaviour is as follows:\n\n* Conan host profile: settings detected from CMake. For anything that cannot be detected from CMake, it falls back to the `default` Conan profile.\n* Conan build profile: the `default` Conan profile.\n\nPlease note that for the above to work, a `default` profile must already exist. If it doesn't, `cmake-conan` will invoke Conan's autodetection mechanism which tries to guess the system defaults.\n\nIf you need to customize the profile, you can do so by modifying the value of `CONAN_HOST_PROFILE` and `CONAN_BUILD_PROFILE` and passing them as CMake cache variables. Some examples:\n\n* `-DCONAN_HOST_PROFILE=\"default;auto-cmake\"`: perform autodetection as described above, and fallback to the default profile for anything else (default behaviour).\n* `-DCONAN_HOST_PROFILE=clang16`: do not perform autodetection, and use the `clang16` profile which must exist in the Conan profiles folder (see [docs](https://docs.conan.io/2.0/reference/commands/profile.html?highlight=profiles%20folder#conan-profile-list).)\n* `-DCONAN_BUILD_PROFILE=\"/path/to/profile\"`: alternatively, provide a path to a profile file that may be anywhere in the filesystem.\n* `-DCONAN_HOST_PROFILE=\"default;custom\"`: semi-colon separated list of profiles. A compound profile will be used (see [docs](https://docs.conan.io/2.0/reference/commands/install.html#profiles-settings-options-conf)) - compunded from left to right, where right has the highest priority.\n\n### Customizing the invocation of Conan install\nThe CMake-Conan dependency provider will autodetect and pass the profile information as described above. If the `conan install` command invocation needs to be customized further, the `CONAN_INSTALL_ARGS` variable can be used. \n* By default, `CONAN_INSTALL_ARGS` is initialised to pass `--build=missing`. If you customize this variable, please be aware that Conan will revert to its default behaviour unless you specify the `--build` flag.\n* Two arguments are reserved to the dependency provider implementation and must not be set: the path to a `conanfile.txt|.py`, and the output format (`--format`).\n* Values are semi-colon separated, e.g. `--build=never;--update;--lockfile-out=''`\n\n\n## Development, contributors\n\nThere are some tests, you can run in python, with pytest, for example:\n\n```bash\n$ pytest -rA\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconan-io%2Fcmake-conan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconan-io%2Fcmake-conan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconan-io%2Fcmake-conan/lists"}