Hi,

 

I have some code with multiple circular dependencies. I rely on the
transitive dependency mechanism to create the link line. Following is a
short example of libs which can't be resolved properly.

==> My question is: if there a way to help cmake create a working link
line.

 

In the example, each function is in a separate file:

-          lib1 contains files 

o        f1.c (defines function lib1f1)

o        f2.c (defines function lib1f2)

o        f3.c (defines function lib1f3)

-          lib2 contains file

o        f1.c (defines function lib2f1)

-          lib3 contains files 

o        f1.c (defines function lib3f1)

o        f2.c (defines function lib3f2)

 

And here is the call graph of these functions: main -> lib1f1 -> lib2f1
-> lib3f1 -> lib1f2 -> lib3f2 -> lib1f3

 

Using target_link_libraries(), I set that:

-          exe depends on lib1

-          lib1 depends on lib2, lib3

-          lib2 depends on lib3

-          lib3 depends on lib2

 

And the generated link line is : lib1 lib2 lib3 lib1 lib2 lib3.

 

Of course, this fails with an undefined symbol lib1f3 first declared in
lib3/f2.c.

 

So, is there a way to help cmake resolve this link line without changing
the lib1,2,3 code (because my project has too many of such circular
dependencies to make such corrections possible. (I'm still evaluating if
we can switch to our build system to cmake))

Thanks,

Alexandre 

 



This email was sent to you by Thomson Reuters, the global news and information 
company.
Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Thomson Reuters.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to