Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Pierre Mallard
Surely I can refactor code to avoid cross-dependencies... But the problem is more on the definition of the target link line at executable level than on cross dependency. Indeed even if C does not depends on B, or in your example X, writing TARGET_LINK_LIBRARIES(EX1 libD libX1) would always leads t

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Leif Walsh
I see. I would not try to express this complexity to cmake. Is there a way you can separate the alternate functionality out of C so that it doesn't cause the dependency graph to fragment this way? Usually circular dependencies mean you need to refactor something anyway. If you can make the dep g

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Pierre Mallard
Hi everyone, Reading answer from leif and andreas, leads me to advance a bit. To my opinion writing target_link_libraries(exe1 libB libC) would certainly works (but I m not able to test it at the moment). But my problem should be explain the more tricky way : libB depends on libC function implem

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Andreas Stahl
Hello Pierre, self reply as a correction, sorry: what I meant was that only linking the executables TARGET_LINK_LIBRARIES(EX1 libB libC1) TARGET_LINK_LIBRARIES(EX2 libB libC2) should suffice. Andreas Am 25.02.2013 um 14:14 schrieb Andreas Stahl: > Hello Pierre, > > my knowledge concerning the

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Leif Walsh
I think you shouldn't make B depend on anything, and just make sure that you list all the libs you need at executable link time. Sent from my iPhone On Feb 25, 2013, at 7:47, Pierre Mallard wrote: > Well it is indeed possible and it works... Note that static libraries 's > object files are b

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Andreas Stahl
Hello Pierre, my knowledge concerning the linking process is rather limited, but wouldn't that mean you don't need to inter-link the libraries at all, when the symbols are resolved at link-time with the executable? add_executable(ex1 libB libC1 libC2) should suffice then. Best regards, Andreas

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Pierre Mallard
Well it is indeed possible and it works... Note that static libraries 's object files are built with unresolved symbols. Final resolution is performed when building executable Therefore libB can compile without libC and conversely ... Anyone else ? On Mon, Feb 25, 2013 at 12:23 PM, Ansis Māliņš

Re: [CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Ansis Māliņš
>libB depends on libC and libC depends on libB. How is that even possible? You compile B and it fails because there's no C yet. You compile C and it fails because there's no B yet. -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensou

[CMake] Resolving static lib dependency at executable link time

2013-02-25 Thread Pierre Mallard
Hello everyone, This is certainly a known issue but I coulnd't find anything related to this needs on internet : I got : an executable EX, a static library B and a static library C with cross dependencies : libB depends on libC and libC depends on libB. EX depends on libB If I write : TARGET_LIN