Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: pozzugno on November 08, 2013, 07:57:02 pm
-
I'm designing a library that can be compiled in two different modes depending on the definition of MODE1 or MODE2.
In order to test the two variants, I created two projects in Code::Blocks that use the same source files for the library.
Project1 is configured with -DMODE1 and Project2 is configured with -DMODE2.
If a make Project2 after making Project1, the library isn't compiled another time and is wrongly linked to the executable
in MODE1. The solution I use is to Rebuild Project2 to force the compilation of the library.
Is there a better method?
-
I woule prefer to have the sources in one project not two, but use two differebt targets for the different modes.
And make sure every lib (egally if in project or target) has it's own object folder, probably executable dir and own place for the build lib (or two different names for the libs).
-
I woule prefer to have the sources in one project not two, but use two differebt targets for the different modes.
I see two problems with your solution. If I change something in the library (and it often happens because I'm developing the library), I have to recompile the project for two targets, but it seems there isn't a friendly "Make All the Targets" command. I would have to compiler the first target, switch to the second target and compile again.
And make sure every lib (egally if in project or target) has it's own object folder, probably executable dir and own place for the build lib (or two different names for the libs).
I know how to change the folder for the output executable file of the project, but I don't know how to change in Code::Blocks the object of a single .c file destination folder or the destination folder for all the sources.
-
Edit: Look-up Virtual Targets; name one "All" and add both targets to them.
Change the Object Output Directory for each Target.
Project -> Property -> Build Targets
Tim S.
-
In "Project -> Properties -> Build targets" you can set the "Objects output dir" per target.
Here you can also create a "Virtual target" and add both real targets to it.
If you chose the virtual target in the combobox, all related targets wil be (re-)build.