4

I'm working with conan 0.16.0 and I can't figure how to install a package in the local store. My idea is to create a recipe, create every package I want from the recipe, install them in the local store and then upload them on a conan server to make them available to other developer without them having to recompile the package as they are already available.

What I actually do :

  • Create the recipe (the conanfile.py with my build and export method)
  • I install it in the local store using conan export user/channel
  • I check that I can build by doing conan build
  • I create a package with mkdir mypackage, cd mypackage and conan package ..
  • And then, I don't know how to install this package in the local store (after, I would like to upload the recipe & the packages from the local store to the server)

The only way I found to have my package in the local store is to have another recipe that requires the the previous recipe and then make a conan install --build. A package of my first recipe will be build and will be present in my local store but this way forces me to create "fake" requirements to achieve my goal.

Is there any way I could build my packages for the settings I want and then directly install them in the local store ?

dkg
  • 1,775
  • 14
  • 34

1 Answers1

3

From the conan docs you have to conan install to create a package. The conan build command is only used to build your local project, not to build the package that you have exported.

Actually, the preferred way to create and test packages is using the test_package functionality, please follow the tutorial. Generally speaking the docs are written in a very tutorial like fashion, I recommend following them.

If you check the docs or command line help to conan package it will show you that is a command only for debugging, and to be used in rare occassions. You can perfectly work without it.

drodri
  • 5,157
  • 15
  • 21
  • So, in other words, to create a binary package for a specific target I have to consume the package recipe either by creating another package recipe that requires my binary package or by consuming the package via the `test_package`. But I can't directly do a build & install. `test_package` is safer because in that way I can ensure my libs are correctly built. Works for me :) – dkg Dec 06 '16 at 15:23
  • Yes, you can also do a ``conan install Pkg/0.1@user/channel --build -g txt`` that will also create the package, and generate a text file with the information of the package, as include directories, library names. You could also use ``-g cmake`` to generate a cmake file for including in your project. But this approach is manual and error prone. I think it is much better to really ensure that the package is working by being linked from another project, and using a conanfile or the test_package functionality is much more convenient and explicit. – drodri Dec 07 '16 at 16:36