Code::Blocks Forums
User forums => Using Code::Blocks => Topic started 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 ?
-
Make the non-application projects to produce static libraries and then link the static libraries in the application project.
-
Thanks for your answer oBFusCATed.
Yes, it's a solution but how to automatically defined the statics libraries names in the application project ?
-
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. :)
-
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.
-
cacb:
External dependency.
Project -> Properties
Tab: Build Targets
Select target in left pane
Click on dependencies
Tim S.