User forums > Using Code::Blocks
Manage Gobal project including sub-projects
JNo:
Hello,
In project we have a structure split in many sub-structures in order to facilitate the re-used of functionality.
Then I create a workspace with several sub-projects and a final sub-project "application.cbp" where I want to link all objects of all sub-projects : when you use only one project, we can use variable $link_objects but how to do that with the full workspace ?
oBFusCATed:
Make the non-application projects to produce static libraries and then link the static libraries in the application project.
JNo:
Thanks for your answer oBFusCATed.
Yes, it's a solution but how to automatically defined the statics libraries names in the application project ?
oBFusCATed:
Setup dependencies between the projects. Make sure all projects have the same target names. If you do this then cb would setup the linking options auto-magically for you, I think.
Note: If this doesn't work you'll have to post a minimal example project. :)
cacb:
--- Quote from: oBFusCATed on December 03, 2019, 07:59:03 pm ---Setup dependencies between the projects. Make sure all projects have the same target names. If you do this then cb would setup the linking options auto-magically for you, I think.
Note: If this doesn't work you'll have to post a minimal example project. :)
--- End quote ---
I use C::B workspaces with many projects and build dependencies between them. It is true that when you use consistent target names, the build works fine across projects, but I don't think there is any connection between build dependency and libraries to link against, at least I have not detected such a feature. So I just list the libraries explicitly where they are used.
The project dependencies define the project build order, but this does affect which libraries to link against.
Navigation
[0] Message Index
[#] Next page
Go to full version