Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: ta0 on July 16, 2016, 06:02:57 pm
-
I have set up a large project with many Build Targets used for building libraries (.a files) that are then supposed to be linked together with some other files into the final executable, which is also a Build Target.
Right now I build this by selecting each Target in the Build > Select target menu, and then pressing Build > Rebuild.
How can I automate this? I have read threads about scripting, but there were few examples and I didn't understand how to do it (I understand squirrel, but it is still difficult to understand how to script C::B).
I have also read about the Target Inter-dependencies or Inter-target dependencies feature of C::B, but I didn't understand how to configure it at all.
-
I would try using a Virtual Target called "All"; just like the CB Core project does it.
Tim S.
-
Use a virtual target then the targets that are part of it will be compiled from top to bottom. So if you reorder them in the project you can manage the dependencies. To get real dependencies you have to use separate projects. One for each library or executable and make sure that you use the same target names in each project.
-
Thanks, this worked great.
-
The trick is ok, but it does not work if a target depends on pre-build steps. In my case, the via file is generated from C::B variables (different for each target) using the pre-build step, but this step is executed only for first target.
Tested on C::B 17.12.
As per http://forums.codeblocks.org/index.php?topic=15572.0, I should specify the pre/post-build steps for EACH target, but as they are the same for all targets (they changes as I am using variables), it is more efficient to have it in project pane, instead of target pane.
-
The trick is ok, but it does not work if a target depends on pre-build steps. In my case, the via file is generated from C::B variables (different for each target) using the pre-build step, but this step is executed only for first target.
Tested on C::B 17.12.
As per http://forums.codeblocks.org/index.php?topic=15572.0, I should specify the pre/post-build steps for EACH target, but as they are the same for all targets (they changes as I am using variables), it is more efficient to have it in project pane, instead of target pane.
Without seeing the pre/post commands I see no way to help you.
Tim S.