[Cmake] How to build two libraries that mutually import functions

Karr, David David.Karr at titan.com
Wed, 24 Mar 2004 18:31:11 -0500


Among the libraries that I build for a certain project,
there are two mutually dependent libraries.
Specifically, library A exports some functions that
library B needs to import, and library B exports some
functions that library A needs to import.

I'm trying to build these libraries in Visual C++ 6.0.
Apparently this means I have to run LIB first on one
library to generate the .exp file, then I can build
the other library, and finally I can finish building
the first library.

Frankly I don't even know how to get Visual C++ to do
this automatically even if I create the workspace by hand.
But I was hoping CMake would set up the workspace so
that it builds correctly.  So far, I have tried listing
each library in a TARGET_LINK_LIBRARIES command in the
CMakeLists.txt file of the other library, but the=20
libraries still won't build.

Does this problem have a known solution other than
removing all mutual imports?

And by the way, what is the difference between
TARGET_LINK_LIBRARIES and LINK_LIBRARIES?

David Karr