Wireshark-dev: Re: [Wireshark-dev] New linker warnings compiling Wireshark on Windows
From: Peter Wu <[email protected]>
Date: Wed, 17 Oct 2018 22:17:06 +0200
On Thu, Oct 04, 2018 at 12:17:31PM -0700, Guy Harris wrote:
> On Oct 4, 2018, at 11:19 AM, Guy Harris <[email protected]> wrote:
> 
> > doesn't help, and there doesn't appear to *be* any documentation for the alleged "CMAKE_C_FLAGS_*" flags.
> 
> What they meant was "CMAKE_<LANG>_FLAGS_* flags".
> 
> And I've filed a bug against CMake complaining about the opacity of the documentation.

I have analyzed the problem and replied to your report:
https://gitlab.kitware.com/cmake/cmake/issues/18422

Summary: CMake applies additional flags based on the configuration
(Debug, RelWithDebInfo). These may contain "/INCREMENTAL" and are
appended *after* CMAKE_EXE_LINKER_FLAGS.

So the "working" situation happened to have flags in this order:

- CMAKE_EXE_LINKER_FLAGS: (empty)
- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO: /INCREMENTAL
- LINK_FLAGS: /INCREMENTAL:NO /RELEASE

After Guy's patch (now reverted), it changed to:

- CMAKE_EXE_LINKER_FLAGS: /INCREMENTAL:NO /RELEASE
- CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO: /INCREMENTAL
- LINK_FLAGS: (empty)

So the effective flags are /RELEASE /INCREMENTAL and that causes
warnings.

The best workaround I can think of is to filter out the /INCREMENTAL and
/INCREMENTAL:YES flags from <VAR>_<CONFIG>.
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl