[CMake] How to add dependency relations between libs and executable

vakano zhongle at proplussolution.com
Sun Apr 17 04:31:19 EDT 2016


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: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264.html
Sent from the CMake mailing list archive at Nabble.com.


More information about the CMake mailing list