ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] cmake / OSX - FindM.cmake

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 13 Mar 2016 20:39:05 -0700
On Mar 13, 2016, at 8:27 PM, Edwin Groothuis <edwin.groothuis@xxxxxxxxxxxx> wrote:

> I got it. Invoking cmake as:
>  
> $ cmake -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/ .
>  
> does do it cleanly. Also for PCAP. Also for ZLib.

Yes, those are all system-supplied libraries, at least in the "runtime" sense.  (For Linux people, think packages such as "libm", "libpcap", "zlib" or "libz", or whatever they're called on your distribution.)

The *header files*, however, are supplied as part of either Xcode or the command-line development tools.  (For Linux people, think the "XXX-dev" package corresponding to the "XXX" package, or whatever convention your distribution uses.  For Windows, I guess think "SDK" or whatever it's called.)

If you only install the Shiny GUI IDE Xcode, you don't get /usr/include.  You *do* get command-line tools, but they're buried inside the Xcode application bundle, just as the headers are.

If you install the "command-line (development) tools", you get separate copies of the headers, command-line tools, etc., in the usual UN*X places.

You can install both.  I sincerely hope that Apple manages to keep them in sync with updates to Xcode and the command-line tools.

It Would Be Nice if CMake were to make an effort to provide a nice way to, on OS X, look in "the appropriate places" without requiring that you tell it where to look.  Perhaps we're all missing the right magical way to do that.