[CMake] Building Mac kext from CMake

Tim Schooley tim at sbdev.net
Thu Jul 10 07:06:49 EDT 2008


Hi Alan,

Alan W. Irwin wrote:
> 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.

I've just replied to Sean's post on this. I've been successfully using
CMake for a while, building on both Linux and Mac OS X. I love it! :D

> 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.

I'm pretty sure I don't want to go down the route of attempting to
compile the kext within CMake. It'd get very messy, very quickly.

Also, it looks like CPack may not be flexible enough (and certainly not
documented enough) for me. The kext requires superuser privileges to
install, as well as placing files into the /System/Library/Launch*
directories. To be frank, I have no idea how this would be accomplished
:( I feel like I'm missing a large chunk of documentation that can't be
found!

Kind regards,

Tim



More information about the CMake mailing list