Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] cmake giving options the compiler does not understand

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 2 Jan 2014 16:30:14 -0800
On Jan 2, 2014, at 4:21 PM, Joerg Mayer <jmayer@xxxxxxxxx> wrote:

> On Thu, Jan 02, 2014 at 03:16:17PM -0800, Guy Harris wrote:
> 
>> But, if that's the case, was it cached when a compiler that *does* support -Wshorten-64-to-32 was used, and then a *different* compiler was used?  (Building in a directory stored on a file server can make this more likely to happen, as you might be building on machine A and then re-building on machine B without clearing out all the stuff left around by the configure-and-build on machine A.)
> 
> I will change the cmake tests to run separately for c and c++ - if I read the
> commits correctly you did this for autotools already. I (and thus the code)
> currently assume that the c and c++ compiler are from the same "source".

Even if they're from the same source, they might not accept the same flags.

In *most* cases, that's an indication that you have a mismatched C-compiler/C++-compiler pair, and the autoconf script reports it as such with a warning, but, in two cases, it's expected - one compiler might accept -Wmissing-prototypes or -Wmissing-declarations when the other doesn't.

Are we really encountering a case where the C compiler accepts -Wshorten-64-to-32 but the C++ compiler doesn't, or *vice versa*?  Or are we encountering a case where *neither* compiler accepts it, but CMake isn't detecting that?