Open boussaffawalid opened 3 years ago
Have you tried repackaging the DLLs inside MyLib (i.e. MyLib contains both DLLs in its binary directory)?
Actually, We wanna avoid, Our dependency graph is more much complicated and I just made this example to explain the situation.
For example:
regarding private conan requirement, are they analogic to cmake private linking?
No, private conan requirements are not propagated, they are not as smart as CMake private/public/interface mechanism.
The only case I see where you can safely use private conan requirement is: the recipe builds a shared lib, and its "private" dependency is static or header-only (as well as all its own dependencies, recursively)
Does it make sense to add an ability to specify non transitive deps to the conan requires method. Something like:
self.requires("zlib/1.2@drl/testing", private=False, override=False, transitive=True)
Ultimately all deps should be public, but there should be a way to define non transitive deps as currently all public deps are transitive.
Is MyLib
a shared library (DLL)? If not, then the final application will have to link against its dependencies, otherwise it likely won't work as intended.
With that out of the way, if MyLib
is indeed a shared library, then there is no reason for the final application to link against its dependencies (unless the final application uses them directly).
In either case, whether to link or not, it's the responsibility of the next layer down (the build system, CMake?), not conan. You can have everything as public dependencies in conan (so you have the DLLs available) and still not link against transitive dependencies (as linking isn't conan's job).
For more help, we would need more information about your setup.
In conan, every dependency is transitive - if you build all dependencies from source. This can sometimes be hidden by providing precompiled binaries for dependencies, but at the basic level I can always say conan install . --build all
to force build everything from source.
We use conan cmake/cmake_multi generators with TARGETS
for simplicity so that we only link against against one target CONAN_PKG::<PKG-NAME>
. However this is problematic as:
CONAN_PKG::<PKG-NAME>
define all shared conan dependencies as transitive dependencies by defining the cmake property INTERFACE_LINK_LIBRARIES
.I don't know if this is a limitation of cmake/cmake_multi generators! Besides that cmake/cmake_multi generators doesn't support conan components Maybe we need to switch to a different generator
Hello,
I use conan to build a windows application, and I have a confusion regarding private conan requirement, are they analogic to cmake private linking?
Here is the situation:
Now the challenge:
If I define zlib and tensorflow as public conan requirements
The linking information will propagate to
Final application
and I ended up with myFinal application
linking both Tensorflow and zlib which I dont want to.If I define zlib and tensorflow as private conan requirements
The linking information will not propagate to
Final application
which is the appropriate behavior. HoweverFinal application
does not know about Tensorflow and zlib anymore but they are still needed as we need the DLLs as runtime deps.Any suggestion how to fix this ?