Hi,
I have a complicated situation :). I avoided the kind of approach, that
you suggest because it's not modular - main project file contains
add_subdirectory commands, which have to be maintained "by hand" - you
can see the non-modular information leak here: "add_subdirectory( liba )".
The task is to convert ~100 projects with acyclic (non-tree)
dependencies to cmake. It would be nice to double-click on any project
in the graph and have the build system figure out the needed
dependencies from "lower" levels automatically. The reason that I want
to have subgraph builds is that VS would probably break if I included
the whole beast at once :).
regards,
Egon
Amitha Perera wrote:
Bätge wrote:
> ADD_DEPENDENCIES( exea liba )
> ADD_DEPENDENCIES( exeb liba )
That should be TARGET_LINK_LIBRARIES.
Egon: as Stephan says, you want to avoid this include() stuff. That is
only useful some complicated situations. What you want is probably
something like this: (I added a libb for fun.)
/liba/CMakeLists.txt:
...
add_library( liba ... )
...
/libb/CMakeLists.txt
...
add_library( libb ... )
...
/exea/CMakeLists.txt
...
add_executable( exea )
target_link_libraries( exea liba libb )
...
/exeb/CMakeLists.txt
...
add_executable( exeb )
target_link_libraries( exeb liba libb )
...
/CMakeLists.txt
PROJECT( proj )
add_subdirectory( liba )
add_subdirectory( exea )
add_subdirectory( exeb )
(You may be able to to the last step from a proj subdirectory, as you
had in your original email, but I can't remember right now if that is a
2.4.x feature or a 2.6.x feature.)
If you move to CMake 2.6, you can even create self-standing sub-project
solutions. (I think CMake 2.4 doesn't quite do that, but I could be
wrong.)
Amitha.
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake