Conan Documentation Release 1.25.2
Total Page:16
File Type:pdf, Size:1020Kb
Conan Documentation Release 1.25.2 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 All platforms, all build systems and compilers.............................5 1.5 Stable...................................................5 1.6 Community................................................6 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............................................8 2.5 Initial configuration...........................................9 2.6 Install from source............................................9 2.7 Update..................................................9 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........................................... 18 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 4.4 Debugging packages........................................... 29 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 Define the package information..................................... 57 5.8 Inspecting Packages........................................... 59 i 5.9 Packaging Approaches.......................................... 59 5.10 Package Creator Tools.......................................... 64 6 Uploading Packages 67 6.1 Remotes................................................. 67 6.2 Uploading Packages to Remotes..................................... 68 6.3 Using Bintray............................................... 69 6.4 Artifactory Community Edition for C/C++............................... 71 6.5 Running conan_server.......................................... 72 7 Developing packages 79 7.1 Package development flow........................................ 79 7.2 Packages in editable mode........................................ 83 7.3 Workspaces................................................ 87 8 Package apps and devtools 95 8.1 Running and deploying packages.................................... 95 8.2 Creating conan packages to install dev tools............................... 101 8.3 Build requirements............................................ 104 9 Versioning 109 9.1 Introduction to versioning........................................ 109 9.2 Version ranges.............................................. 113 9.3 Package Revisions............................................ 114 9.4 Lockfiles................................................. 115 10 Mastering Conan 123 10.1 Use conanfile.py for consumers..................................... 123 10.2 Conditional settings, options and requirements............................. 125 10.3 Build policies............................................... 127 10.4 Environment variables.......................................... 127 10.5 Virtual Environments........................................... 129 10.6 Logging.................................................. 130 10.7 Sharing the settings and other configuration............................... 133 10.8 Conan local cache: concurrency, Continuous Integration, isolation................... 133 11 Systems and cross building 135 11.1 Cross building.............................................. 135 11.2 Windows Subsystems.......................................... 146 12 Extending Conan 151 12.1 Customizing settings........................................... 151 12.2 Python requires.............................................. 154 12.3 Python requires (legacy)......................................... 158 12.4 Hooks................................................... 162 13 Integrations 167 13.1 Compilers................................................ 167 13.2 Build systems............................................... 167 13.3 IDEs................................................... 193 13.4 CI Platforms............................................... 208 13.5 Other Systems.............................................. 226 13.6 Version Control System......................................... 245 13.7 Custom integrations........................................... 246 13.8 Linting.................................................. 251 ii 13.9 Deployment............................................... 251 14 Configuration 257 14.1 Download cache............................................. 257 15 Howtos 259 15.1 How to package header-only libraries.................................. 259 15.2 How to launch conan install from cmake................................ 261 15.3 How to create and reuse packages based on Visual Studio....................... 262 15.4 Creating and reusing packages based on Makefiles........................... 265 15.5 How to manage the GCC >= 5 ABI................................... 267 15.6 Using Visual Studio 2017 - CMake integration............................. 268 15.7 Working with Intel compiler....................................... 271 15.8 How to manage C++ standard [EXPERIMENTAL]........................... 271 15.9 How to use Docker to create and cross-build C and C++ Conan packages............... 273 15.10 How to reuse Python code in recipes................................... 275 15.11 How to create and share a custom generator with generator packages................. 278 15.12 How to manage shared libraries..................................... 282 15.13 How to reuse cmake install for package() method............................ 287 15.14 How to collaborate with other users’ packages............................. 287 15.15 How to link with Apple Frameworks.................................. 288 15.16 How to package Apple Frameworks................................... 288 15.17 How to collect licenses of dependencies................................. 289 15.18 How to extract licenses from headers.................................. 289 15.19 How to dynamically define the name and version of a package..................... 290 15.20 How to capture package version from SCM: git............................. 290 15.21 How to capture package version from SCM: svn............................ 290 15.22 How to capture package version from text or build files......................... 291 15.23 How to use Conan as other language package manager......................... 291 15.24 How to manage SSL (TLS) certificates................................. 296 15.25 How to check the version of the Conan client inside a conanfile.................... 297 15.26 Use a generic CI with Conan and Artifactory.............................. 298 15.27 Compiler sanitizers............................................ 300 16 Reference 303 16.1 Commands................................................ 303 16.2 conanfile.txt............................................... 369 16.3 conanfile.py............................................... 371 16.4 Generators................................................ 409 16.5 Profiles.................................................. 442 16.6 Build helpers............................................... 446 16.7 Tools................................................... 469 16.8 Configuration files............................................ 496 16.9 Environment variables.......................................... 508 16.10 Hooks................................................... 517 16.11 CONAN_V2_MODE.......................................... 520 17 Videos and links 523 18 FAQ 525 18.1 General.................................................. 525 18.2 Using Conan............................................... 526 18.3 Troubleshooting............................................. 529 19 Glossary 533 iii 20 Changelog 537 20.1 1.25.2 (19-May-2020).......................................... 537 20.2 1.25.1 (13-May-2020).......................................... 537 20.3 1.25.0 (06-May-2020).......................................... 537 20.4 1.24.1 (21-Apr-2020)........................................... 538 20.5 1.24.0 (31-Mar-2020).......................................... 538 20.6 1.23.0 (10-Mar-2020).......................................... 539 20.7 1.22.3 (05-Mar-2020).......................................... 540 20.8 1.22.2 (13-Feb-2020)........................................... 540 20.9 1.22.1 (11-Feb-2020)........................................... 540 20.10 1.22.0 (05-Feb-2020)........................................... 541 20.11 1.21.3 (03-Mar-2020).........................................