Conan Documentation Release 1.23.0
Total Page:16
File Type:pdf, Size:1020Kb
Conan Documentation Release 1.23.0 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........................................... 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 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 Inspecting Packages........................................... 57 5.8 Packaging Approaches.......................................... 57 i 5.9 Package Creator Tools.......................................... 62 6 Uploading Packages 63 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 ii 14 Configuration 247 14.1 Download cache............................................. 247 15 Howtos 249 15.1 How to package header-only libraries.................................. 249 15.2 How to launch conan install from cmake................................ 251 15.3 How to create and reuse packages based on Visual Studio....................... 252 15.4 Creating and reusing packages based on Makefiles........................... 255 15.5 How to manage the GCC >= 5 ABI................................... 257 15.6 Using Visual Studio 2017 - CMake integration............................. 258 15.7 Working with Intel compiler....................................... 261 15.8 How to manage C++ standard [EXPERIMENTAL]........................... 261 15.9 How to use Docker to create and cross-build C and C++ Conan packages............... 263 15.10 How to reuse Python code in recipes................................... 265 15.11 How to create and share a custom generator with generator packages................. 268 15.12 How to manage shared libraries..................................... 272 15.13 How to reuse cmake install for package() method............................ 277 15.14 How to collaborate with other users’ packages............................. 277 15.15 How to link with Apple Frameworks.................................. 278 15.16 How to package Apple Frameworks................................... 278 15.17 How to collect licenses of dependencies................................. 279 15.18 How to extract licenses from headers.................................. 279 15.19 How to dynamically define the name and version of a package..................... 280 15.20 How to capture package version from SCM: git............................. 280 15.21 How to capture package version from SCM: svn............................ 280 15.22 How to capture package version from text or build files......................... 281 15.23 How to use Conan as other language package manager......................... 281 15.24 How to manage SSL (TLS) certificates................................. 286 15.25 How to check the version of the Conan client inside a conanfile.................... 287 15.26 Use a generic CI with Conan and Artifactory.............................. 288 15.27 Compiler sanitizers............................................ 290 16 Reference 293 16.1 Commands................................................ 293 16.2 conanfile.txt............................................... 354 16.3 conanfile.py............................................... 356 16.4 Generators................................................ 394 16.5 Profiles.................................................. 425 16.6 Build helpers............................................... 430 16.7 Tools................................................... 453 16.8 Configuration files............................................ 479 16.9 Environment variables.......................................... 491 16.10 Hooks................................................... 500 16.11 CONAN_V2_MODE.......................................... 504 17 Videos and links 507 18 FAQ 509 18.1 Upgrading to Conan 1.0......................................... 509 18.2 General.................................................. 510 18.3 Using Conan............................................... 512 18.4 Troubleshooting............................................. 515 19 Glossary 519 iii 20 Changelog 523 20.1 1.23.0 (10-Mar-2020).......................................... 523 20.2 1.22.3 (05-Mar-2020).......................................... 524 20.3 1.22.2 (13-Feb-2020)........................................... 524 20.4 1.22.1 (11-Feb-2020)........................................... 524 20.5 1.22.0 (05-Feb-2020)........................................... 524 20.6 1.21.3 (03-Mar-2020).......................................... 526 20.7 1.21.2 (31-Jan-2020)........................................... 526 20.8 1.21.1 (14-Jan-2020)........................................... 526 20.9 1.21.0 (10-Dec-2019).......................................... 526 20.10 1.20.5 (3-Dec-2019)........................................... 528 20.11 1.20.4 (19-Nov-2019).........................................