[CMake] Problem with design and ADD_SUBDIRECTORY

Martin Santa María martin_san03 at hotmail.com
Tue Jul 14 11:08:43 EDT 2009


Hello everyone,

I have a design problem. I have a new project consisting on different packages. Each package should be built as a library but it could depend on libraries generated by other packages. Also there is an executable built from some of these libraries:

root/
  CMakeLists.txt   -> generates executable with some package libraries
  package1/
    CMakeLists.txt -> generates package1.lib
  package2/
    CMakeLists.txt -> generates package2.lib that depends on package1 library and its header files. so it must include root/package1/


My problem begins with INCLUDE_DIRECTORIES and LINK_DIRECTORIES. I would like that packages include those directories that are really needed to search for headers and libraries, in the previous example package2 should includes directory package 1 so it could find package1's headers, but package1 shouldn't know about package2. To archive this, I think I need to use ADD_SUBDIRECTORY so each sub directory has its own includes and libraries directories. The problem is that the root CMakeLists.txt should known the list of generated libraries and source files so it could make the global executable. 
I don't find the way to pass this information from package's CMakeLists.txt to the root CMakeLists.txt.

Do you have some idea?
Regards,

Martin

_________________________________________________________________
Volvé famosa a tu mascota con MSN
http://events.latam.msn.com/tumascota
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090714/ce17b5c4/attachment.htm>


More information about the CMake mailing list