Conan: [question] custom configs path

Created on 6 Feb 2020  路  7Comments  路  Source: conan-io/conan

Hello!
I'm looking into integrating conan to the build system of a complex project and I'm curious if it is possible to store all the conan configuration files inside my repo and have conan look for these files there instead of in the default path ./conan. I've been experimenting with conan_config_install() and that seems to work, but as a safety requirement I would need to perform this installation each time I run CMake (We want to make sure that if for some reason the configuration inside ./conan changes, they get overridden every time we compile), so installing remotes, configurations and profiles each time seams inefficient to me, and it would be way better to just define a path for conan to find configurations.
I was considering using CONAN_USER_HOME, but that would also change the directory of ./data, right?
To summarize, what I would like to do is maintain the cache inside ./conan/data but move all the config files to something like ${CMAKE_PROJECT_DIR}/conan_config. Is this possible?
Thanks!

triaging question

All 7 comments

Hi @ericriff,

This sounds to me like a very magic and a bit intrusive for a developer but maybe in an automated environment inside an organization it fits.

First, option you could consider is using a hook to automate the update of the Conan configuration. I am not sure this will work, because the conan settings and configuration will be already loaded when a hook gets triggered, but maybe you could force a conan re-run everytime there is a config update.

On another approach, the different folders for configuration and cache storage is something that can be done using CONAN_USER_HOME and storage.path in the conan.conf https://docs.conan.io/en/latest/reference/config_files/conan.conf.html#storage

Maybe the proposals above can give you a hint to try something that works for you.


This issue is more related to Conan that to ConanCenter, so I am transferring this issue to that repo.

Thanks for the quick answer! I'm going to try to make the second approach work.

Hi @ericriff

I am wondering why it would be a better approach

, they get overridden every time we compile), so installing remotes, configurations and profiles each time seems inefficient to me, and it would be way better to just define a path for conan to find configurations.

It is not really a difference, is it? I fail to see it. In either case, the build needs to git pull the changes to the repo that contains the configuration, or do conan config install, which will update the configuration from the remote repo as well. Every time, every build, needs to do the step, doesn't it?

What we want to prevent is an user messing with the conan configs and then launching a build with the wrong set of configurations. That's why we want make sure that the build process sets up every setting and overrides whatever the user did.
Granted, the user could also mess with the setting files stored in our repo, but I think it's more likely that someone runs a conan command without fully understand it and breaks something without realizing it.

@ericriff did it worked for your case? Can we consider the question as answered?

I'm still looking into different approaches, but you can close this. Thank you very much for your time!

Thank you! Do not hesitate to share your solution here if you want 馃槃

Was this page helpful?
0 / 5 - 0 ratings