[CMake] Question about transitive dependencies
John Doe
ufnoise at gmail.com
Thu Dec 4 16:37:37 EST 2008
Hello,
This discussion is based on my knowledge of the Gnu Compiler Collection.
My understanding of the linking process is that B will never link
against A, because static libraries don't link against other static
libraries. Library B will have unresolved symbols when linking C.
You must therefore add a dependency between C and A.
Therefore:
C links against B and A
B doesn't link against anything
B needs the header information for the functions of A.
I never use shared libraries, but I think the dynamic linker may need
to resolve a dynamic B against a dynamic A.
Juan
On Thu, Dec 4, 2008 at 3:25 PM, Robert Dailey <rcdailey at gmail.com> wrote:
> Hi,
>
> Currently I have 3 projects named A, B, and C. A and B are both static
> libraries, and C is an executable. B depends on A, and C depends on B via
> add_dependencies(). When I generate a visual studio 9 project from this
> setup, how will the libraries be linked? The way I want this to work is for
> C to link against both A and B, and B will not link against A (Since B's
> dependencies should transfer to C). Is there a way to accomplish this
> behavior? I want to avoid using target_link_libraries for the most part
> because it's redundant. I'm already specifying B as a dependency of C
> through add_dependency(), why should I have to list B's static library file
> as a dependency of C's executable? Can't CMake pull this information from
> the call to add_dependency()?
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
More information about the CMake
mailing list