Author Topic: Manage Gobal project including sub-projects  (Read 3286 times)

Offline JNo

  • Single posting newcomer
  • *
  • Posts: 7
Manage Gobal project including sub-projects
« 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 ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Manage Gobal project including sub-projects
« Reply #1 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline JNo

  • Single posting newcomer
  • *
  • Posts: 7
Re: Manage Gobal project including sub-projects
« Reply #2 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 ? 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Manage Gobal project including sub-projects
« Reply #3 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. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Manage Gobal project including sub-projects
« Reply #4 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Manage Gobal project including sub-projects
« Reply #5 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org