Code::Blocks

User forums => Using Code::Blocks => Topic started by: JNo on December 03, 2019, 09:08:26 am

Title: Manage Gobal project including sub-projects
Post by: JNo on December 03, 2019, 09:08:26 am
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 ?
Title: Re: Manage Gobal project including sub-projects
Post by: oBFusCATed on December 03, 2019, 09:13:23 am
Make the non-application projects to produce static libraries and then link the static libraries in the application project.
Title: Re: Manage Gobal project including sub-projects
Post by: JNo on December 03, 2019, 03:44:20 pm
Thanks for your answer oBFusCATed.

Yes, it's a solution but how to automatically defined the statics libraries names in the application project ? 
Title: Re: Manage Gobal project including sub-projects
Post by: 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. :)
Title: Re: Manage Gobal project including sub-projects
Post by: cacb on December 05, 2019, 11:57:32 am
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. :)

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.
Title: Re: Manage Gobal project including sub-projects
Post by: stahta01 on December 05, 2019, 07:36:26 pm
cacb:

External dependency.

Project -> Properties
Tab: Build Targets
Select target in left pane
Click on  dependencies

Tim S.