Hi Alexander, I had to create a very similar setup at work. My solution was to define a global property for the list of projects to generate. There is a top level CMakeLists.txt file which doesn't define any targets, but just includes all subdirectories as necessary. In pseudo-code, my solution is as follows:
## top_level/CMakeLists.txt: set_property(GLOBAL PROPERTY my_project_list ${variable_defined_on_command_line}) get_property(projects GLOBAL PROPERTY my_project_list) while(projects) set_property(GLOBAL PROPERTY my_project_list "") foreach(proj IN LISTS projects) if (proj_not_yet_added) add_subdirectory(${proj}) # this can add projects to my_project_list global property endif() endforeach() get_property(projects GLOBAL PROPERTY my_project_list) endwhile() ## To make the dependency specification as fool-proof as possible, I also overrode target_link_libraries() so that it accepts an extended `project:target' syntax (such as `target_link_libraries(myTarget ProjectA:lib1)') and automatically appends the project to the global property. I hope this helps you; if you need more info, I can go into technical details a bit more. Petr On Sun, Apr 29, 2012 at 9:43 PM, Alexander Broekhuis <a.broekh...@gmail.com> wrote: > Hi all, > > I am looking for a way to have dependencies between independent projects. > For example > > ProjectA > ProjectB depends on A > ProjectC depends on B and A > > What I like to do is that when project B or C is build, the dependencies are > also build. But I also want the project to be independent, to be more > specific, if the project files for A are being generated I don't want the > files for B and C generated. > > Basically my problem is, that I don't want all Makefile to be generated all > at once. But only those needed for a certain project (and its dependencies). > This helps with not having installed every library needed by all > (sub)projects. > > Has anyone any experience with this, or perhaps some hints how I can solve > this problem? > > TiA! > > -- > Met vriendelijke groet, > > Alexander Broekhuis > > -- > > 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 -- 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