Author Topic: Configuring several compilers for the same project  (Read 2970 times)

Offline Morwenn

  • Multiple posting newcomer
  • *
  • Posts: 13
Configuring several compilers for the same project
« on: November 04, 2015, 01:30:09 am »
I used to compile a project with g++ and recently tried to compile the same project with MSVC 2015 RTM. I configured both compilers for the project from Code::Blocks in the project build options, but it seems that the options defined for g++ leak into the MSVC options:

    Command line error D8021 : invalid numeric argument '/Wnon-virtual-dtor'

And the compiler options defined for MSVC leak into the g++ options:

     \Wp64||No such file or directory|

Basically, I expect Code::Blocks to be able to keep several sets of options for several compilers for a same project. Is it a bug or is it by design?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Configuring several compilers for the same project
« Reply #1 on: November 04, 2015, 01:50:25 am »
I suppose you're using different targets for every compiler.
There is policy dropdown that you should use to limit the inheritance of options.
In a case like yours you'd set it to "Use target options only".
(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 Morwenn

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Configuring several compilers for the same project
« Reply #2 on: November 04, 2015, 12:42:31 pm »
It indeed solves the problem, thanks.

That said, the -Wnon-virtual-dtor option was set for g++ Debug only (not in the global project options) and "Append target options to project options" still tried to add it even though I was trying to compile with MSVC in debug, which means that "Append target options to project options" picked the project options, the MSVC debug options (as expected) but also the g++ debug options, for some reason. That feels like a bug.

On a side note, wouldn't it make more sense to put the compiler selection more important than the target selection? I may be missing some valid arguments, but I find it strange to have, for example, a g++ project, an MSVC debug and a g++ Release. I would expect that changing the compiler for one target changes it for all the targets and also for the project. From a UI point of view, it would mean putting the compiler selection box above everything else in the dialog.

Anyway, thanks for the pointers.

Note: don't hesitate if you think that the compiler framework redesign forum is a better place for the suggestion.


EDIT: actualy, even with "Use target options only" it sometimes adds the g++ debug flags to the MSVC command line. I don't understand anymore.
« Last Edit: November 04, 2015, 05:07:51 pm by Morwenn »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Configuring several compilers for the same project
« Reply #3 on: November 04, 2015, 09:21:04 pm »
EDIT: actualy, even with "Use target options only" it sometimes adds the g++ debug flags to the MSVC command line. I don't understand anymore.
If you've converted a gcc target to msvc target then all options set on the target that we don't know how to convert are moved to the other options.
And you have to convert them manually to the msvc equivalents.

About the UI: Every target can choose its own compiler, so the drop down is in the correct place. The per project compiler is meant for global options for this compiler.

Generally it will be best if we make it possible to make trees of targets, but no one has decided to do it. This way you can have per project options, then two targets for global compiler options (one target per compiler) and then two subtargets targets under the compiler targets for debug and release options.
(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!]