Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug/Release (Windows) #616

Closed
ghost opened this issue Oct 30, 2016 · 2 comments
Closed

Debug/Release (Windows) #616

ghost opened this issue Oct 30, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 30, 2016

Hello,

I've had a problem which I have not paid much attention to up to now. On Windows, I am always building the Release configuration of projects. If we want to use different dependencies between release and debug builds how can we do it with a simple conanfile.txt? I've noticed that I am always downloading the release version of my dependencies when I write a conanfile.txt and then execute "conan install". Also, is there a way to have conan & cmake link to a different build of a conan package (Debug or Release) depending on the Debug/Release configuration selection in Visual Studio?

Thanks!

@memsharded
Copy link
Member

A simple conanfile.txt wouldn't allow conditional dependencies. There are a couple of approaches:

  • Write 2 (or more conanfile.txt, name them conanfile_release.txt, for example). Use the filename option for conan install to invoke one or the other conanfile.txt. If the dependencies are the same, just use the -s build_type=Debug command line parameter
  • Use a conanfile.py instead. Not necessary to define name, version, package(), package_info()... as you are not creating a package, just consuming. Use the configure() or the requirements() methods to define your conditional logic for dependencies based on self.settings.build_type

No, there is no way to select debug/release dependencies when switching from visual studio, because of the way and relationship that visual studio has with cmake. Just go to the command line and switch the build_type, as dependencies are cached, it will be instantaneous. Also, if you want you can create packages both for Release/Debug configurations, but this is not what package creators are typically doing. I recommend switching in the command line, for me is an operation equivalent to switching branches from git.

@ghost
Copy link
Author

ghost commented Oct 30, 2016

That's solid advice thanks! I know that the VS-cmake combo is a bit rigid with regard to this and I was thinking along these lines (not in such detail of course), but I wanted to ask you in case I had missed some detail.

It might be good to mention something about this in the documentation at some point. I don't know if it's there somewhere but I couldn't find anything when I looked. VS users are very used to switching between Release and Build configurations via a simple drop-down so, when something crashes (which can happen with some statically linked libraries) they might get the idea that it's because of conan.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant