No, they all belong to a higher-level project. There is a root directory with a CMakeLists.txt. This file calls ADD_SUBDIRECTORY(dir_i) for each subproject (a, b, c and d). Each sub-project is in his own directory, with a CMakeLists.txt for each of them. <div>
<br></div><div>Root : CMakeLists.txt</div><div> - dir_a : CMakeLists.txt</div><div> - dir_b : CMakeLists.txt</div><div> - dir_c : CMakeLists.txt</div><div> - dir_d : CMakeLists.txt</div><div><br></div><div>In the root CMakeLists.txt I call </div>
<div> ADD_SUBDIRECTORY(dir_a)</div><div> ADD_SUBDIRECTORY(dir_b)</div><div> ADD_SUBDIRECTORY(dir_c)</div><div> ADD_SUBDIRECTORY(dir_d)</div><div><br></div><div>My a CMakeLists contains:</div><div>SET(a project_a)</div>
<div>add_library(${a} ${SRCS_a} ${HDRS_a})</div><div>SET_TARGET_PROPERTIES(${a} PROPERTIES OUTPUT_NAME ${a} DEBUG_POSTFIX "_${VS_DIR}_${PLATFORM}_d" RELEASE_POSTFIX "_${VS_DIR}_${PLATFORM})</div><div><br></div>
<div><div>My c CMakeLists contains:</div><div>SET(c project_c)</div><div>add_library(${c} ${SRCS_c} ${HDRS_c})</div></div><div>ADD_DEPENDENCIES( ${c} ${a} )</div><div><br></div><div>I hope it is clearer now and that I provided the required information...</div>
<div><br></div><div>Ludo</div><div><br><div class="gmail_quote">2011/11/4 Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 11/04/2011 10:47 AM, Ludovic Hoyet wrote:<br>
> Hi,<br>
><br>
> I am using cmake to build an application made up of a dozen projects. We<br>
> use cmake to automatically generate solutions for x86, x64, and both VS<br>
> 2005 and 2010.<br>
><br>
> Here is an idea of our organisation:<br>
><br>
</div>> * a.lib, which has no dependency<br>
> * b.lib, which has no dependency<br>
> * c.lib, which depends on a and b<br>
> * d.dll, which depends on c<br>
<div class="im">><br>
> Each project lies in its own subdirectory, and has its own<br>
> CMakeLists.txt file. In order to keep track of the lib/dll generated for<br>
> our different platforms, we automatically post-fix each lib/dll with<br>
> _x86/_x64 and _vc80/_vc100 (e.g., a_x86_vc100.lib), and with an _d for<br>
> debug (e.g., a_x86_vc100_d.lib).<br>
><br>
> In the CMakeLists.txt files, I use target_link_libraries to link each<br>
> target with the corresponding libraries, for instance:<br>
><br>
</div>> TARGET_LINK_LIBRARIES( c debug a_${VS}_${PLATFORM}/d optimized<br>
> a/${VS_DIR}/${PLATFORM} debug b/${VS}_${PLATFORM}/d optimized<br>
> b/${VS_DIR}_${PLATFORM})<br>
<div class="im">><br>
> In Visual Studio, the different "Project Dependencies" between the<br>
> various projects do not appear. I wonder if there is something I miss,<br>
> or if it is simply not compatible with our library post-fix. I also<br>
> tried to use ADD_DEPENDENCIES(c a b) but it does not seem to work either.<br>
><br>
> Does anyone has an idea how to solve this?<br>
><br>
> Cheers,<br>
><br>
> Ludovic<br>
<br>
<br>
</div>Are these projects completely isolated, i.e. there is no higher-level<br>
CMakeLists.txt file that calls add_subdirectory() for each of the<br>
project directories?<br>
<br>
1: if they belong to the same project, then you should use the *target*<br>
names, not the *output* names in target_link_libraries().<br>
<br>
2: if they indeed are independent projects, you should take a look at<br>
this:<br>
<a href="http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file" target="_blank">http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file</a><br>
and for each of the libraries create a <libname>Config.cmake file.<br>
<br>
A bit more information on how your projects are structured would help.<br>
Also, showing example code is always useful.<br>
<br>
HTH<br>
<br>
Michael<br>
<font color="#888888">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</font></blockquote></div><br><br clear="all"><div><br></div>-- <br>_______________________________________<br><br>Ludovic Hoyet<br>Research Fellow, <div><span style="font-family:Tahoma, Helvetica, sans-serif;font-size:13px;line-height:16px;background-color:rgb(255, 255, 255)">Graphics Vision and Visualisation group,</span><br>
Trinity College Dublin<br><a href="http://www.scss.tcd.ie/~hoyetl/" target="_blank">http://www.scss.tcd.ie/~hoyetl/</a></div><br>
</div>