[CMake] Independent libraries in parallel directories

Nils H. Busch nilsb at cbs.mpg.de
Tue Jun 21 07:09:50 EDT 2005


Hi,

I am trying to build an application with source code in the top-level
directory and two independant libraries in two separate subdirectories.

When I link these two libraries in the top-level CMakeLists.txt file to
the application via LINK_LIBRARIES, cmake creates inter-dependancies for
these two libraries and calling make results in a seemingly recursive
attempt to alternatively build either one of these two libraries to
satisfy the dependancies and the computer freezes with a 100% load.
When I use TARGET_LINK_LIBRARIES instead, no inter-dependancies are
created, but cmake gives an error message stating
library xy is defined using ADD_LIBRARY after the library is used using
TARGET_LINK_LIBRARIES for application z. This breaks CMale's dependency
handling. Same for the other library. Subsequent call to make, however,
correctly compiles application and libraries.

Apparently, I am doing something fundamentally wrong for such a design.
Or is this behaviour a bug ?
Any pointers for how to set up CMakeLists.txt correctly appreciated.

I am using CMake v 1.9.0 on Debian GNU/Linux with gcc 3.3.3

Thanks.

-- 
  Nils H. Busch


More information about the CMake mailing list