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

2016-04-21 Thread vakano
Hi, Chuck, J, Thanks for you all great help! It is clear for me now ^.^ vakano -- View this message in context: http://cmake.3232098.n2.nabble.com/How-to-add-dependency-relations-between-libs-and-executable-tp7593264p7593313.html Sent from the CMake mailing list archive at Nabble.com. --

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

2016-04-21 Thread Chuck Atkins
> in your proj_a example, when target_link_librairies invoke Lib B directly > which generated in another project b, how does proj_a recognize it > I think the reason is proj_a, b, c are all the sub directories of > project root, if no root layer, B can not be invoked in proj_a, right? > That's

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

2016-04-20 Thread J Decker
On Wed, Apr 20, 2016 at 6:21 PM, vakano wrote: > Hi, Chuck, > > Thanks for the explanation, it is very clear now. > > One last question is: > > *folder/proj_a* > CMakeLists.txt: > add_executable(A main.cpp) > target_link_libraries(A B C) > > *folder/proj_b* >

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

2016-04-20 Thread vakano
Hi, Chuck, Thanks for the explanation, it is very clear now. One last question is: *folder/proj_a* CMakeLists.txt: add_executable(A main.cpp) target_link_libraries(A B C) *folder/proj_b* CMakeLists.txt: project(proj_b) add_library(B proj_b.cpp) in your proj_a example, when

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

2016-04-20 Thread Chuck Atkins
> So for this parallel project structure, an upper level cmakelist used to > organize and setup relationship with lib A, B, C right? > Correct. The top level CMakeLists.txt lets A B and C all build under a single configuration. One more question is, if use the upper level cmake list, lib_B ,

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

2016-04-19 Thread vakano
Hi, Chuck, Thanks for your great help! "Lib_B and Lib_C, build before A" that is exactly what I need. So for this parallel project structure, an upper level cmakelist used to organize and setup relationship with lib A, B, C right? One more question is, if use the upper level cmake list, lib_B

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

2016-04-19 Thread Chuck Atkins
> cmake, the old top layer project is proj_a, which at the same layer with > proj_b and proj_c, if I add an extra top layer as the root you mentioned, the generated make file structure will be changed, top layer make file will be root instead of proj_a. > > Is there any way to add the dependency

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

2016-04-17 Thread vakano
Hi, Anatoly, Besides, my project structure is a little bit special, I am doing a conversion from current make file flow to cmake, the old top layer project is proj_a, which at the same layer with proj_b and proj_c, if I add an extra top layer as the root you mentioned, the generated make file

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

2016-04-17 Thread vakano
Hi, Anatoly, Thanks for your guidance, I am a little confused why it need an upper level cmakelist? Could you pls explain how the dependency works? Thanks, Le -- View this message in context:

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

2016-04-17 Thread Anatoly Shirokov
*folder* CMakeLists.txt: project(root) add_subdirectory(proj_b) add_subdirectory(proj_c) add_subdirectory(proj_a) *folder/proj_a* CMakeList.txt: project(proj_a) add_executable(*main *main.cpp) target_link_libraries(*main **proj_b* *proj_c*) *folder/proj_b* CMakeList.txt: project(proj_b)

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

2016-04-17 Thread vakano
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