Wireshark-dev: Re: [Wireshark-dev] Mac Build Error
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 21 Jan 2016 23:26:19 -0800
On Jan 21, 2016, at 9:36 PM, Roland Knall <rknall@xxxxxxxxx> wrote:

> FYI, the only sure-fire way in CMAKE to set specific only linker flags is using the target properties.

So what's the best way to, within a .cmake file, create a temporary target, with those properties, and with a particular small piece of source code, build it, and note whether it succeeded or failed, so that we can check whether a given linker flag is supported by the linker we're using and, if and only if it is, adding it to the properties for our targets?

That's what we're trying to do here - the equivalent of what our AC_WIRESHARK_LDFLAGS_CHECK does with autotools.

> This works in 9 out of 10 cases on all 3 major plattforms. In my experience it depends on what is called, and when, and most likely fails with MSVC.

...and it needs to, at a minimum, work on all platforms where we're using the UN*X Makefile generator; extra credit if it also works with all the Visual Studio generators (where it would be useful if we want to use a flag supported by some, but not all, versions of VS's linker), the Xcode generator (where it would be useful if we want to use a flag supported by some, but not all, versions of OS X's ld), and the NMake generator (and there may be people who'd like it to work with the MinGW Makefile generator).

(Or have we found something that autotools can do that CMake just *can't* do?)