-
Notifications
You must be signed in to change notification settings - Fork 985
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
Best practices for mixing and matching Release with RelWithDebInfo packages #4221
Comments
I've seen people suggesting, e.g.:
How does that compare, e.g. to simply:
|
@michaelmaguire I imagine the true difference there is that when you set the |
@michaelmaguire Did you ever find a satisfying solution for a best practice of RelWithDebInfo? I am in the boat where I want to build my library RelWithDebInfo but I don't care if any of the dependencies are RelWithDebInfo or Release. |
@pivotal-jbarrett , for now we have stuck with:
|
I came across this issue while trying to figure out how to use Release packages of dependencies with RelWithDebInfo configurations, and I wanted to add my solution here for anyone in the future. In certain cases where conanfiles are simply packaging pre-built artifacts or copying sources without a
I was also interested in the compatibility() method introduced in Conan 1.47.0, and I tried to do something similar there:
But it didn't work for me and resulted in some errors that I forget at the moment. But worth mentioning in case anyone else has a use-case for it. |
I am reviving this issue as I am currently pulling my hair on the exact same subject without a success. def build(self)
cmake = CMake(self)
if self.settings.build_type=="Release":
cmake.build_type = 'RelWithDebInfo' does not do anything, because the So I am trying the other way around. Creating all CMake files for Apparently I am able to force particular package setting in the profile, i.e. using the following semantics:
But this is a bit cumbersome as I would need to do this override only when the root package Is there a way (any way) to build a project with |
I had a similar problem. My conan profile has It took me an hour to figure out this was the cause because the compiler just fails because it can't find the library header files. By sheer chance I tried changing the CMAKE_BUILD_TYPE to "Release" and that fixed the problem. How can I use CMAKE_BUILD_TYPE=RelWithDebInfo in my projects, but find header files to packages from conan center that use build_type=Release? I would prefer not to have to manually include an explicit build_type for each library in the conan profile as the previous poster suggested. |
@NightWulfe I gave up on trying any other I am not sure what platform are you on, but this is how I do it on Windows, using MSVC toolchain. # Project options
# ===============
option (DEBUG_INFO "Generate debug info in the current build" OFF)
if (DEBUG_INFO)
LIST (APPEND COMPILER_OPTIONS_OVERRIDE "/Zi")
LIST (APPEND LINKER_OPTIONS_OVERRIDE "/DEBUG")
endif() is what I put into a top level target_compile_options (target PRIVATE ${COMPILER_OPTIONS_OVERRIDE})
# turn on linker optimization back on in RelWithDebInfo config
target_link_options (target PRIVATE $<$<NOT:$<CONFIG:Debug>>:/INCREMENTAL:NO /OPT:REF /OPT:ICF>)
target_link_options (target PRIVATE ${LINKER_OPTIONS_OVERRIDE}) The fist linker options are necessary to enable linker optimization, which the Then I turn on |
Hi all, It has been some time since this issue was reported, and probably there are different use cases here. For having dependencies in one build_type and the "consumer" project in a different build type it can be achieved by defining that in the command line, for example for installing Release dependencies but the current build is RelWithDebInfo:
Could you please clarify if this is what you are looking for, and if this solves your issues. Another possibility in Conan 2.0 if binary compatibility fallback is desired between different build_types artifacts, I think this would be quite straightforward in the new |
I am having similar issues as described here but much simpler case: What does the ampersand in suggested
|
If you did a |
Thanks @memsharded , I am migrating to the modern integrations and conan2 from an older conan1. Is there a correct way to achieve mixed |
Yes, So in general the approach to achieve mixed conan install ... -s build_type=Release -s &:build_type=RelWithDebInfo -s zlib/*:build_type=RelWithDebInfo That is basically it, you tell each dependency (and the consumer project via In Conan 2.0 you can define the |
Thank you @memsharded |
Are there any other effects of the |
Yes, it might have some other (minor) effects, like defining the VS runtime for that configuration in multi-config setup like VS (via |
Sorry to revive this old thread. I'm trying to set up my builds so I can do Debug, Release, and RelWithDebInfo (in the latter case I'm fine with the dependencies being in Release mode, though RelWithDebInfo would be ideal). My use of conan is only as a consumer (i.e. to build, install & use dependencies). Is this "&:" syntax documented somewhere so I can see what it does and how to use it effectively? |
It is true that the |
Besides all the above recommendations and explanations, the new I am closing this ticket as solved, the new |
We build many open sources packages from scratch and publish internally using Conan, then build our own internal libraries against those with Conan.
In #1564 "Add RelWithDebInfo as a supported build_type" @memsharded stated:
This is a use case that appeals to us. How should this work in practice?
If package
Current
depends on packageBase
, and Base was built withbuild_type=Release
, if I try to buildCurrent
withbuild_type=RelWithDebInfo
it's usually not going to consider the Base libraries ofbuild_type=Release
as satisifying dependencies.What should be our practice here?
Conan version 1.10.1 Windows
To help us debug your issue please explain:
The text was updated successfully, but these errors were encountered: