Author Topic: Getting project to relink when dependencies are recompiled  (Read 2054 times)

Offline Wavesonics

  • Multiple posting newcomer
  • *
  • Posts: 43
Getting project to relink when dependencies are recompiled
« on: January 28, 2009, 10:29:35 pm »
I have a project that depends on other projects in the work space.

I have those other projects set up property as dependencies, so when I compile the top level project, it checks for changes and recompiles the projects it depends on.

Problem is, if there were no changes to the top level project, it will recompile the sub projects, but not relink the top project. Is there any way to get it to do this?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Getting project to relink when dependencies are recompiled
« Reply #1 on: January 29, 2009, 07:20:30 am »
Is it dynamically linked ?
If yes, it does not need a rebuild, unless you change your header files. In this case the api might have changed and a new build should be done.

If only the implementation changes, and the libs are loaded dynamically, no new build is needed.

You also don't have to build your whole system after every linux or windows update, right ?
That's one advantage of dynamically loaded libs.

Offline Wavesonics

  • Multiple posting newcomer
  • *
  • Posts: 43
Re: Getting project to relink when dependencies are recompiled
« Reply #2 on: January 29, 2009, 08:15:59 am »
No, it's all statically linked.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Getting project to relink when dependencies are recompiled
« Reply #3 on: January 29, 2009, 10:39:27 am »
You can setup dependencies on external files to force a relink:
  • right-click your project in the manager, go to "Properties -> Build targets",
  • chose the target you want to set the dependencies,
  • click on "Dependencies",
  • add the library you want to depend on to the "External dependencies files".

You have to setup this for every target you have, because different targets (e.g. Debug and Release) might depend on different libs (or whatever).