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] configure fails with cmake on macosx

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Tue, 28 Sep 2010 15:25:05 +0200
On Fri, Sep 24, 2010 at 11:57:56PM -0700, Guy Harris wrote:
> Is it just me, or is CMake's "option" command of limited use?

It is a bit different, the rest is how I set the defaults, see below.

> For one thing, there appears to be no way to specify an option on the command line, unlike with autoconf, where you can specify --enable-XXX or --disable-XXX, or specify --withXXX with or without a value or specify --without=XXX?

Acutally, you can. You can override the defaults by running
cmake -DENABLE_CAP=ON/OFF

> For another thing, they appear to be purely Boolean - there's no way to have the default value for "with XXX" be "yeah, if XXX is available", with the user able to select "with XXX, and, if XXX isn't available, fail the configuration" or "without XXX, even if it's available"?

That's mostly true, but it should be doable: Right now, I collect a list of
packages to check for and then check them as REQUIRED, so things fail of course.
I should be able to add another value in addition to just ON/OFF like OPT(ional)
and not set the REQUIRED keyword in that case.

> The default behavior for, for example, libcap should be "use it if it's available, don't use it if it's not", so that on non-Linux systems (which probably don't have libcap), it Just Works, and for Linux systems that lack libcap, it Just Works (by not building with libcap), and, for Linux systems that have libcap, it Just Works (by building with libcap).  It might be nice to allow the user to override that, but, if CMake doesn't make that easy, I'm inclined to make the default behavior the only available behavior (by explicitly setting CAP_OPTIONS to an empty string, so that REQUIRED is *NOT* one of the option).

Yes, that would be another solution, but being able to specifiy the stuff on the
command line might be another option.

If the ENABLE_feature way sounds OK, I'd go ahead and implement it. Just
let me know.

ciao
       Joerg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.