Quantcast

Build Dependencies problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Build Dependencies problem

Eric Tellefsen

Hi,

I'm new to the list and relatively new to CMake.  I'm currently in the process of attempting to migrate an existing project to CMake (from plain Unix makefiles)

The source files for each library are in a series of subdirectories as illustrated in the simple diagrams at the bottom of the mail.

What I'm currently doing is creating CMakeLists.txt for each individual library.  I am also trying to represent the inter-library dependencies by adding add_subdirectory() and add_dependencies() to each library project (which almost all do).

However, when I try to do this, it does not work as in the case where lib3 is dependent on lib & headers within lib2.  When I run 'cmake .' to build the files, I get a message telling me that lib2 is not a subdirectory of lib3 and  the makefile is not created.

Would someone be able to point me in the right direction?

Thank you,

Eric

The physical source tree looks like this (limiting this to libs)

Libs
   |
   - lib1
   |
   = lib2
   |
   _ etc..

The lib hierarchy looks like this

Lib1
      |
      Lib2
          |
          Lib3

so lib2 depends on Lib1 and Lib3 depends on lib 2
---
This communication may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this communication
in error) please notify the sender immediately and destroy this
communication. Any unauthorized copying, disclosure or distribution of the
material in this communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information
contained in this communication should not be regarded as such.

_______________________________________________
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Build Dependencies problem

Eric Noulard
2009/7/14 Eric Tellefsen <[hidden email]>:

>
> Hi,
>
> I'm new to the list and relatively new to CMake.  I'm currently in the
> process of attempting to migrate an existing project to CMake (from plain
> Unix makefiles)
>
> The source files for each library are in a series of subdirectories as
> illustrated in the simple diagrams at the bottom of the mail.
>
> What I'm currently doing is creating CMakeLists.txt for each individual
> library.  I am also trying to represent the inter-library dependencies by
> adding add_subdirectory() and add_dependencies() to each library project
> (which almost all do).
>
> However, when I try to do this, it does not work as in the case where lib3
> is dependent on lib & headers within lib2.  When I run 'cmake .' to build
> the files, I get a message telling me that lib2 is not a subdirectory of
> lib3 and  the makefile is not created.

With CMake sibbling directories does not know each other.

> Would someone be able to point me in the right direction?

I do not cross such dependency case (with this particular directory layout)
but does it work if your specify dependencies/target_link
in the upper level CMakeLists.txt; i.e. the one in Libs.

Libs/CMakeLists.txt:

add_subdirectory(lib1)
add_subdirectory(lib2)
add_subdirectory(lib3)
target_link_libraries(lib3 lib2)

LIbs/lib1/CMakeLists.txt
    add_library(lib1 <sources>)

LIbs/lib2/CMakeLists.txt
    add_library(lib2 <sources>)

LIbs/lib3/CMakeLists.txt
    add_library(lib3 <sources>)


> This communication may contain confidential and/or privileged information.
> If you are not the intended recipient (or have received this communication
> in error) please notify the sender immediately and destroy this
> communication. Any unauthorized copying, disclosure or distribution of the
> material in this communication is strictly forbidden.

You should not post to a public and archived ML with this footer message :-(

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
_______________________________________________
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Build Dependencies problem

Bill Hoffman
In reply to this post by Eric Tellefsen
Eric Tellefsen wrote:

>
> Hi,
>
> I'm new to the list and relatively new to CMake.  I'm currently in the
> process of attempting to migrate an existing project to CMake (from
> plain Unix makefiles)
>
> The source files for each library are in a series of subdirectories as
> illustrated in the simple diagrams at the bottom of the mail.
>
> What I'm currently doing is creating CMakeLists.txt for each individual
> library.  I am also trying to represent the inter-library dependencies
> by adding add_subdirectory() and add_dependencies() to each library
> project (which almost all do).
>

Use target_link_libraries instead of add_dependencies.

-Bill
_______________________________________________
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
Loading...