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: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Wed, 08 Jan 2014 10:04:10 -0500
On 01/05/14 14:40, Guy Harris wrote:

On Jan 5, 2014, at 10:00 AM, Jeff Morriss <jeff.morriss.ws@xxxxxxxxx> wrote:

On 01/04/2014 09:51 PM, Guy Harris wrote:

On Jan 4, 2014, at 9:17 AM, Jeff Morriss <jeff.morriss.ws@xxxxxxxxx> wrote:


6) make # just to show that it works (I stopped the build after a few C files were compiled)
7) vi ../CMakeLists.txt
8) Put "-Wshorten-64-to-32" back where it was (at the end of WIRESHARK_C_ONLY_FLAGS)
9) cmake ..

Presumably CMake then reports something such as

	-- Checking for flag: -Wshorten-64-to-32
	-- Performing Test WS_C_FLAG_VALID44
	-- Performing Test WS_C_FLAG_VALID44 - Success

in that case, meaning it thinks -Wshorten-64-to-32 *is* supported by the C compiler?

Well it doesn't do the full check on this (cached) pass, it just says:

-- Checking for flag: -Wjump-misses-init
-- Checking for flag: -Wshorten-64-to-32
-- C-Flags:  -Wall -W -Wextra -Wendif-labels [...]

So is the issue that the tests have the ordinal number of the flag, rather than the name of the flag, in the name of the test, with that name being used when caching results, so that the cache is bogus if you've reordered the flags since the cached results are generated?

Either that or it was caching the variable name.

(Presumably this also caused some flag that *does* work *not* to be added, as the results of the test of -Wshorten-64-to-32 were used on that flag.)

That is my presumption as well.

Regardless, it appears Joerg has fixed it in r54638. :-)