0

I want to use conan new https://docs.conan.io/2.0/reference/commands/new.html to create new project from specific template. But I do not want to manage all templates in the same conan config repo. Instead I want to use git submodule for that. Is it possible?

3
  • 2
    You can use multiple repos, and conan config install them. Each repo can contain different things, you can have some templates in one repo, some profiles in another repo, etc. The conan config install command also has extra -a <args> argument that can be passed to the underlaying git clone command, so you can instruct to fetch submodules with `` --recursive`` Commented Apr 11, 2024 at 8:49
  • It have to be an answer :) Thank you, @drodri Commented Apr 11, 2024 at 8:51
  • I'll post it as an answer, thanks! :) Commented Apr 12, 2024 at 9:36

1 Answer 1

1

You can use multiple repos, and conan config install them. Each repo can contain different things, you can have some templates in one repo, some profiles in another repo, etc. Every conan config install will append files that don't exist, overwrite files that exist.

The conan config install command also has extra -a <args> argument that can be passed to the underlaying git clone command. It is intended mostly to be able to checkout a specific folder, but it is forwarding those arguments to git clone so you can also instruct to fetch submodules with --recursive

For configuration management in Conan, specially if the sources for that configuration is complex (with submodules), it might be worth checking the conan config install-pkg command, that allows to put configuration in a Conan package, so it can benefit from versioning and easy updates conan config install-pkg myconf/[>=1.0 2] and better reproducibility adding the config version to lockfiles. So it might be useful to "pre-process" your source repo with the submodules for the config, create a conan package with a version for it and upload the package, so consumers of the configuration use it instead of the git repo.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.