<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<b>folder</b><br>
CMakeLists.txt:<br>
project(root)<br>
add_subdirectory(proj_b)<br>
add_subdirectory(proj_c)<br>
add_subdirectory(proj_a)<br>
<br>
<b>folder/proj_a</b><br>
CMakeList.txt:<br>
project(proj_a)<br>
add_executable(<b>main </b>main.cpp)<br>
target_link_libraries(<b>main </b><b>proj_b</b> <b>proj_c</b>)<br>
<br>
<b>folder/proj_b</b><br>
CMakeList.txt:<br>
project(proj_b)<br>
add_library(<b>proj_b</b> proj_b.cpp)<br>
<br>
<b>folder/proj_c</b><br>
CMakeList.txt:<br>
project(proj_c)<br>
add_library(<b>proj_c </b>proj_b.cpp)<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">17.04.2016 11:31, vakano пишет:<br>
</div>
<blockquote cite="mid:1460881879295-7593264.post@n2.nabble.com"
type="cite">
<pre wrap="">Hi,
The project structure as below:
folder/proj_a folder/proj_b folder/proj_c
proj_a, proj_b, proj_c are in the same level, proj_a is the main project
use to generate executable main,
proj_b and proj_c use to generate lib_b, lib_c, then link with executable
main, my question is how to
add the dependency to let the lib_b and lib_c compile before executable
main, I have tried the function,
add_dependencies(main lib_b lib_c) and target_link_libraries(main lib_b
lib_c), but did not work,
what I want is to achieve the make file dependency setting like:
"${MAKE}" -f Makefile-${CND_CONF}.mk main
main: lib_b, lib_c
Any suggestion will be highly appreciated!
BTW, as checked from another topic, I use different project name in
cmakelist( project(proj_a),
project(proj_b), project(proj_c) ), does it block the dependency generation
automatically?
Thanks,
Le
--
View this message in context: <a class="moz-txt-link-freetext" href="http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264.html">http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264.html</a>
Sent from the CMake mailing list archive at Nabble.com.
</pre>
</blockquote>
<br>
</body>
</html>