{"id":17340348,"url":"https://github.com/snikulov/conan.examples","last_synced_at":"2025-06-15T09:08:30.315Z","repository":{"id":140969459,"uuid":"268068844","full_name":"snikulov/conan.examples","owner":"snikulov","description":"Examples how to use conan.io C++ package manager","archived":false,"fork":false,"pushed_at":"2020-06-11T14:09:27.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T08:48:25.831Z","etag":null,"topics":["boost","cmake","conan","conan-usage","cplusplus","cpp"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snikulov.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-05-30T11:46:52.000Z","updated_at":"2020-06-11T14:09:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"d03ead9f-3b8a-43b9-a349-3f12ee26a8bd","html_url":"https://github.com/snikulov/conan.examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snikulov/conan.examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikulov%2Fconan.examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikulov%2Fconan.examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikulov%2Fconan.examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikulov%2Fconan.examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snikulov","download_url":"https://codeload.github.com/snikulov/conan.examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snikulov%2Fconan.examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259949682,"owners_count":22936411,"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":["boost","cmake","conan","conan-usage","cplusplus","cpp"],"created_at":"2024-10-15T15:44:42.801Z","updated_at":"2025-06-15T09:08:29.682Z","avatar_url":"https://github.com/snikulov.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Boost + conan.io + CMake example \r\n\r\nWhy the dependency manager???\r\n\r\nBecause:\r\n* It's hard to maintain, especially when the project goes large.\r\n* I'm personally, prefer don't repeat myself (see [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)) and re-use binary whenever possible.\r\n\r\nI try to use conan.io for this. \r\n* It quite easy to switch between Boost versions on any platform. \r\n* And even do this automatically on CI/CD servers.\r\n\r\nUsage example\r\n\r\n1. Intrusive way.\r\n\r\nWe inject generated by Conan settings into CMakeLists.txt by editing it (ref. to [include](https://github.com/snikulov/conan.examples/blob/master/boost.log.intrusive/CMakeLists.txt#L14) ).\r\n\r\n```shell\r\n$ cd boost.log.intrusive; mkdir build; cd build\r\n$ conan install .. --build missing\r\n$ cmake ..\r\n$ cmake --build .\r\n```\r\nWe all set.\r\n\r\n2. Non-intrusive or less intrusive way.\r\n\r\nWe already have our CMakeLists.txt file with a lot of ```find_packages(...)``` in it.\r\n\r\nHow to tell CMake to use Conan's binary packages?\r\n\r\nInject search paths using [CMAKE_TOOLCHAIN_FILE](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html).\r\n\r\n```shell\r\n$ cd boost.log.nonintrusive; mkdir build; cd build\r\n$ conan install .. --build missing\r\n$ cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_paths.cmake\r\n$ cmake --build .\r\n```\r\nWe all set.\r\n\r\n**NOTE:** \r\n\r\nI'm not sure if it correct, because I, sometimes, check for CMAKE_TOOLCHAIN_FILE variable to detect if I'm in cross-compilation mode.\r\n\r\nTo avoid TOOLCHAIN_FILE usage, a perhaps better way to provide conan_paths.cmake's variables through the command line.\r\n\r\nfor example \r\n* ```$ cmake .. -D\u003cBOOST_ROOT\u003e=\u003cpath to dependency\u003e [-D...]``` etc.\r\n* include conan_paths.cmake on top of your CMakeLists.txt (intrusive, but less changes in find_packages).\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnikulov%2Fconan.examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnikulov%2Fconan.examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnikulov%2Fconan.examples/lists"}