[CMake] Invoking an script from the link command.

Óscar Fuentes ofv at wanadoo.es
Mon Aug 11 21:12:54 EDT 2008


Mike Jackson <mike.jackson at imts.us> writes:

> Just out of curiosity..
>
> Is the dependency tracking in CMake not adequate enough for your
> project?

No, see below.

> If CMake is used as intended you should not have to manually
> figure out what libraries are needed, CMake should be able to do that
> for you.
>   Maybe you could give some more detail about your use case?

There are several libraries with cyclic dependencies. This forces the
use of `partial linking' (see my message a few days ago). There are a
number of executables, each with different library requirements. Due to
the complexity of the libraries, the executable's CMakeLists.txt (or,
until now, the hand-made Makefile's) does not mention the library names
explicitly. It mentions names of components and a script returns the
libraries and object files (partially linked libs, see above) in the
correct order for the components requested.

A typical link command is like this:

g++ ..flags... object-files... `script component1 component2`

the script returns something like:

-lmylib1 -lmylib2

There is another script that determines library interdependencies (by
analyzing the output of `nm' on the libraries) and builds the first
mentioned script. Of course, this must be performed after the libraries
are built.

So CMake can not determine dependencies because those are unknown until
the libraries are built and cmake time has ended long time ago.

-- 
Oscar



More information about the CMake mailing list