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: Sun, 05 Jan 2014 13:00:51 -0500
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:

Ah, OK, I found a way to reproduce it (in current SVN):

1) rm -rf _cmake_build
2) mkdir _cmake_build && cd _cmake_build
3) vi ../CMakeLists.txt
4) Move the "-Wshorten-64-to-32" flag from where it is in the file to just after "-Wshadow"
5) 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 - Failed

in that case, meaning it thinks -Wshorten-64-to-32 isn't supported by the C compiler?

Yep:

-- Checking for flag: -Wshorten-64-to-32
-- Performing Test WS_C_FLAG_VALID39
-- Performing Test WS_C_FLAG_VALID39 - Failed

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 [...]

Which version of which compiler is this?  (You said "Fedora", so I presume it's either GCC or Clang; which version of Fedora is it?)

I first hit the problem on Fedora 18 (I'd have to check on the compiler version but it was gcc). The method quoted above was reproduced on Fedora 19 (gcc 4.8.2).