Conan Documentation Release 1.21.3
Total Page:16
File Type:pdf, Size:1020Kb
Conan Documentation Release 1.21.3 The Conan team Sep 24, 2021 CONTENTS 1 Introduction 3 1.1 Open Source...............................................3 1.2 Decentralized package manager.....................................3 1.3 Binary management...........................................4 1.4 Cross platform, build system agnostic..................................4 1.5 Stable...................................................5 2 Install 7 2.1 Install with pip (recommended).....................................7 2.2 Install from brew (OSX).........................................8 2.3 Install from AUR (Arch Linux).....................................8 2.4 Install the binaries............................................9 2.5 Initial configuration...........................................9 2.6 Install from source............................................9 2.7 Update.................................................. 10 2.8 Python 2 Deprecation Notice....................................... 10 3 Getting Started 11 3.1 An MD5 hash calculator using the Poco Libraries............................ 11 3.2 Installing Dependencies......................................... 14 3.3 Inspecting Dependencies......................................... 15 3.4 Searching Packages........................................... 17 3.5 Building with Other Configurations................................... 18 4 Using packages 21 4.1 Installing dependencies......................................... 21 4.2 Using profiles............................................... 26 4.3 Workflows................................................ 27 5 Creating Packages 31 5.1 Getting Started.............................................. 31 5.2 Recipe and Sources in a Different Repo................................. 36 5.3 Recipe and Sources in the Same Repo.................................. 37 5.4 Packaging Existing Binaries....................................... 40 5.5 Understanding Packaging........................................ 42 5.6 Defining Package ABI Compatibility.................................. 44 5.7 Inspecting Packages........................................... 55 5.8 Packaging Approaches.......................................... 56 5.9 Package Creator Tools.......................................... 61 6 Uploading Packages 63 i 6.1 Remotes................................................. 63 6.2 Uploading Packages to Remotes..................................... 64 6.3 Using Bintray............................................... 65 6.4 Artifactory Community Edition for C/C++............................... 67 6.5 Running conan_server.......................................... 68 7 Developing packages 75 7.1 Package development flow........................................ 75 7.2 Packages in editable mode........................................ 79 7.3 Workspaces................................................ 83 8 Package apps and devtools 89 8.1 Running and deploying packages.................................... 89 8.2 Creating conan packages to install dev tools............................... 95 8.3 Build requirements............................................ 98 9 Versioning 103 9.1 Introduction to versioning........................................ 103 9.2 Version ranges.............................................. 107 9.3 Package Revisions............................................ 108 9.4 Lockfiles................................................. 109 10 Mastering Conan 117 10.1 Use conanfile.py for consumers..................................... 117 10.2 Conditional settings, options and requirements............................. 119 10.3 Build policies............................................... 121 10.4 Environment variables.......................................... 121 10.5 Virtual Environments........................................... 123 10.6 Logging.................................................. 124 10.7 Sharing the settings and other configuration............................... 127 10.8 Conan local cache: concurrency, Continuous Integration, isolation................... 127 11 Systems and cross building 129 11.1 Cross-building.............................................. 129 11.2 Windows Subsystems.......................................... 137 12 Extending Conan 141 12.1 Customizing settings........................................... 141 12.2 Python requires.............................................. 144 12.3 Python requires (legacy)......................................... 148 12.4 Hooks................................................... 152 13 Integrations 157 13.1 Compilers................................................ 157 13.2 Build systems............................................... 157 13.3 IDEs................................................... 183 13.4 CI Platforms............................................... 198 13.5 Other Systems.............................................. 216 13.6 Version Control System......................................... 235 13.7 Custom integrations........................................... 236 13.8 Linting.................................................. 241 13.9 Deployment............................................... 241 14 Howtos 245 14.1 How to package header-only libraries.................................. 245 ii 14.2 How to launch conan install from cmake................................ 247 14.3 How to create and reuse packages based on Visual Studio....................... 248 14.4 Creating and reusing packages based on Makefiles........................... 251 14.5 How to manage the GCC >= 5 ABI................................... 253 14.6 Using Visual Studio 2017 - CMake integration............................. 254 14.7 Working with Intel compiler....................................... 257 14.8 How to manage C++ standard [EXPERIMENTAL]........................... 257 14.9 How to use Docker to create and cross-build C and C++ Conan packages............... 259 14.10 How to reuse Python code in recipes................................... 261 14.11 How to create and share a custom generator with generator packages................. 264 14.12 How to manage shared libraries..................................... 268 14.13 How to reuse cmake install for package() method............................ 273 14.14 How to collaborate with other users’ packages............................. 273 14.15 How to link with Apple Frameworks.................................. 274 14.16 How to package Apple Frameworks................................... 274 14.17 How to collect licenses of dependencies................................. 275 14.18 How to extract licenses from headers.................................. 275 14.19 How to dynamically define the name and version of a package..................... 276 14.20 How to capture package version from SCM: git............................. 276 14.21 How to capture package version from SCM: svn............................ 276 14.22 How to capture package version from text or build files......................... 277 14.23 How to use Conan as other language package manager......................... 277 14.24 How to manage SSL (TLS) certificates................................. 282 14.25 How to check the version of the Conan client inside a conanfile.................... 283 14.26 Use a generic CI with Conan and Artifactory.............................. 284 14.27 Compiler sanitizers............................................ 286 15 Reference 289 15.1 Commands................................................ 289 15.2 conanfile.txt............................................... 349 15.3 conanfile.py............................................... 351 15.4 Generators................................................ 389 15.5 Profiles.................................................. 420 15.6 Build helpers............................................... 425 15.7 Tools................................................... 446 15.8 Configuration files............................................ 472 15.9 Environment variables.......................................... 484 15.10 Hooks................................................... 493 16 Videos and links 497 17 FAQ 499 17.1 Upgrading to Conan 1.0......................................... 499 17.2 General.................................................. 501 17.3 Using Conan............................................... 502 17.4 Troubleshooting............................................. 505 18 Glossary 509 19 Changelog 513 19.1 1.21.3 (03-Mar-2020).......................................... 513 19.2 1.21.2 (31-Jan-2020)........................................... 513 19.3 1.21.1 (14-Jan-2020)........................................... 513 19.4 1.21.0 (10-Dec-2019).......................................... 514 19.5 1.20.5 (3-Dec-2019)........................................... 515 iii 19.6 1.20.4 (19-Nov-2019).......................................... 515 19.7 1.20.3 (11-Nov-2019).......................................... 515 19.8 1.20.2 (6-Nov-2019)........................................... 515 19.9 1.20.1 (5-Nov-2019)........................................... 515 19.10 1.20.0 (4-Nov-2019)........................................... 515 19.11 1.19.3 (29-Oct-2019)........................................... 517 19.12 1.19.2 (16-Oct-2019)........................................... 517 19.13 1.19.1 (3-Oct-2019)........................................... 517 19.14 1.19.0 (30-Sept-2019).......................................... 517 19.15 1.18.5 (24-Sept-2019).........................................