We recently converted some software, comprising about 300 projects, to use
OBJECT libraries from SHARED libraries so we could create "conveneince"
libraries that were cominations of some of the 300 projects. Not being
able to use target_link_libraries with thier transitive nature made this
very painful, many days of work. Supporting OBJECT libraries in
target_link_libraries calls was mentioned mentioned right back here
https://cmake.org/pipermail/cmake-developers/2012-March/015422.html but
sadly seems still to be on the back burner.

We are faced with a project hierarchy re-org and wanted to try to automate
generation of the dependencies. So we are thinking of doing the following.

1) Remove all the target_sources stuff from all CMakeLists.txt
2) Add add_dependencies calls to specify the project dependencies
3) run cmake with the --graphviz=graphviz.dot
4) Write a program that reads the resultant graphviz.dot and generate
   a file for each project that contain a target_sources call specifying
   all the dependencies for that project
5) In the CMakeLists.txt  for each project include the relevant generated
   target_sources file
6) Rerun cmake

Note the first time cmake gets run all the generated dependency files
are empty so the only dependencies are those specified by add_dependencies
calls.

Obviously the above is a bit convoluted, although we already have a
program to read and use the data in graphviz.dot file for other reason.
So my question is will the above approach work and is there a better one?
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to