[Cmake] Dependency handling problems with 1.8

Andy Cedilnik andy . cedilnik at kitware . com
01 Oct 2003 15:22:04 -0400


Hi Amitha,

CMake 1.6 had this problem, it just did not tell you about it.

The problem is that CMake evaluates directories in a specific order. All
directories are evaluated child first. So, in your case, a_gui is
evaluated first, then a and then b.

Now, this does not mean your project will not work. It will, and
dependency handling will work to some extent. The problem is that if you
modify file in b, it will not rebuild a_gui.

Some of this will be fixed by SUBDIRS ordering.

			Andy


On Wed, 2003-10-01 at 14:00, Amitha Perera wrote:
> CMake 1.8 gives errors on dependency handling in what (we think) are
> reasonable situations.
> 
> Consider:
> 
> (toplevel CMakeLists.txt)
>    SUBDIRS( a )
>    SUBDIRS( b )
> 
> (a/CMakeLists.txt)
>    ADD_LIBRARY( a ... )
>    SUBDIRS( gui )
> 
> (a/gui/CMakeLists.txt)
>    ADD_LIBRARY( a_gui ... )
>    TARGET_LINK_LIBRARIES( a_gui a b )
> 
> (b/CMakeLists.txt)
>    ADD_LIBRARY( b ... )
>    TARGET_LINK_LIBRARIES( b a )
> 
> Here, the dependency tree is simple, well-defined, and acyclic:
>    liba <-- libb <-- liba_gui
> 
> However, CMake issues an error that "b" is seen in a TARGET_LINK
> before it is seen in an ADD_LIBRARY. Further, it issues a dire warning
> that "this may break the dependency handling".
> 
> CMake 1.6 did not have this problem. Does someone know why this
> warning was introduced, and how we can go about making it go away?