[CMake] Building Mac kext from CMake

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Jul 9 17:45:33 EDT 2008


On 2008-07-09 12:28-0400 Sean McBride wrote:

> On 7/9/08 5:06 PM, Tim Schooley said:
>
>> I have a kernel extension that I would like to build from CMake
>> in order to include it in CPack.
>
> You are very likely the first to try that, and I'd be surprised if it
> went smoothly.  IIRC, building kexts requires several non-typical
> compiler/linker flags.  IMHO, CMake's strength is its cross-platform
> nature.  A Mac OS X kext by its very nature is not portable, and I don't
> quite 'get' why you'd want to use CMake.

Tim, on the contrary single-platform is fine for CMake, IMO. I would advise
you to at least give CMake a try since it is quite flexible and relatively
easy to use. The only concern I would have would be if your kernel extension
is simply a compiled object since CMake does not yet have good support for
compiled objects.  Probably what you would want to do is build a static
library and then extract the compiled object from the static library using a
custom command suitable for the platform in question.  Alternatively, you
could figure out the non-documented location where cmake stores its compiled
objects before it places them in a static library, but there are no
guarantees that location will not change in the future.  Or you could just
do the whole thing by a custom command.

BTW, if you are building a static library and special compile flags are
needed, then you should be able to easily set those with the COMPILE_FLAGS
property for either SET_SOURCE_FILES_PROPERTIES or SET_TARGET_PROPERTIES.

Good luck with building your kernel extension, and let the list know how it
goes.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list