[CMake] Setting dependencies between libraries (cmake projects)
Ludovic Hoyet
lhoyet at gmail.com
Fri Nov 4 05:47:26 EDT 2011
Hi,
I am using cmake to build an application made up of a dozen projects. We
use cmake to automatically generate solutions for x86, x64, and both VS
2005 and 2010.
Here is an idea of our organisation:
- a.lib, which has no dependency
- b.lib, which has no dependency
- c.lib, which depends on a and b
- d.dll, which depends on c
Each project lies in its own subdirectory, and has its own CMakeLists.txt
file. In order to keep track of the lib/dll generated for our different
platforms, we automatically post-fix each lib/dll with _x86/_x64 and
_vc80/_vc100 (e.g., a_x86_vc100.lib), and with an _d for debug (e.g.,
a_x86_vc100_d.lib).
In the CMakeLists.txt files, I use target_link_libraries to link each
target with the corresponding libraries, for instance:
TARGET_LINK_LIBRARIES( c debug a_${VS}_${PLATFORM}*d optimized
a*${VS_DIR}*${PLATFORM}
debug b*${VS}_${PLATFORM}*d optimized b*${VS_DIR}_${PLATFORM})
In Visual Studio, the different "Project Dependencies" between the various
projects do not appear. I wonder if there is something I miss, or if it is
simply not compatible with our library post-fix. I also tried to
use ADD_DEPENDENCIES(c a b) but it does not seem to work either.
Does anyone has an idea how to solve this?
Cheers,
Ludovic
_______________________________________
Ludovic Hoyet
Research Fellow,
Graphics Vision and Visualisation group,
Trinity College Dublin
http://www.scss.tcd.ie/~hoyetl/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111104/348d90fa/attachment.htm>
More information about the CMake
mailing list