Hi to all,
Is it possible to redefine default compiler flags for debug and release build target ?
I want that every new project release target by default have -O3 flag for example.
Yes, change the template script you're using to create your projects.
Quote from: oBFusCATed on April 03, 2017, 10:47:37 PM
Yes, change the template script you're using to create your projects.
This can be done by right click on the project type in the "new project wizard" and then hit "edit this script"
ah, got it!
is there any script documentation ?
update:
i just try to use target.AddCompilerOption(_T("-O3")); and it works but it's toggle both flags -o2 and -o3 and also send both to compiler.
is it some bug or i just need also to add something like target.RemoveCompilerOption(_T("-O2")); ?
Have you inspected if the script adds the -O2 explicitly?
Quote from: oBFusCATed on April 04, 2017, 09:42:57 AM
Have you inspected if the script adds the -O2 explicitly?
No there is no explicit flags modification, you can check yourself, this is default console application script.
the place which was modified:
function SetupTarget(target,is_debug)
{
...
if (is_debug)
{
...
}
else
{
...
target.AddCompilerOption(_T("-O3")); // <-- Set -o3
}
// all done!
return true;
}
Look at share\CodeBlocks\templates\wizard\common_functions.script, line 173 (or 201, depending on the compiler).
Quote from: Miguel Gimenez on April 04, 2017, 01:25:10 PM
Look at share\CodeBlocks\templates\wizard\common_functions.script, line 173 (or 201, depending on the compiler).
Yep, now it is works fine, thanks a lot.
But i am not sure that this is good from architectural point of view, because my changes will be reset after first update.
You can place your own templates in your user settings folder. These won't be overridden with the next update.