Conan: [question] The relationship between Conan configuration and setting files

Created on 4 May 2020  路  3Comments  路  Source: conan-io/conan

Based on the documentation, i am aware that conan has the following files that affects its settings or configurations:

  • settings.yml
  • conan.conf
  • profile/profile_files
    Also conanfile.py can also modify what is defined in the above files.
    e.g.:
    I can have conanfile.py to check self.settings.compiler.libcxx to see which lib is used. But i cannot have the value modified.
    I can have conanfile.py to modify the settings in settings.yml.
    I can have conanfile.py to use different profiles

So, it becomes confusing to me that:
what exactly are these files related to each other? And when should i use conanfiles.py to make the modification and when should I modify these files directly?

I tried to dig such info from the doc but it does not seem to be straightforward to me.

triaging question

All 3 comments

  • settings.yml is the definition of what is possible. What settings exists and what values can they take.
  • conanfile.py defines in its settings which of those settings will be used in the recipe
  • profiles are almost equivalent to some command line arguments, and they are a set of specific values for the settings.yml. If they use values not defined in settings.yml that will raise a validation error.

Some minor clarifications:

  • You cannot have conanfile.py to modify anything at settings.yml. It can only declare the settings that are used
  • You cannot have conanfile.py to use different profiles. It is the user/command-line who uses different profiles, and pass their values to conanfiles.

This is very helpful, meanwhile, how about conan.conf file?

conan.conf is a "global/general" configuration of the client tool. For example where the packages are stored, if the client is using revisions or not, the number of CPUs available for parallel operations if possible, if the downloads do retries in case of failures, etc.

  • conan.conf: configuration of the tool
  • settings.yml: definition of spaces of all possible configuration/variants of package binaries
  • profile: a file with one specific definition of configuration/variant values
  • conanfile: recipe, definition of a package: how that package is built, where it gets the sources, what are the artifacts that are useful
Was this page helpful?
0 / 5 - 0 ratings