[CMake] Using XCODE_PRODUCT_TYPE to make kexts

Harry Mallon Harry at codexdigital.com
Tue Jan 17 09:53:49 EST 2017


Hi Gregor,

With a CMake file similar to the following I seem to be able to make proper kexts with the latest nightly 3.7.20170113-g26509. At least they seem to be working, I have been bitten before. "kextutil -nt X.kext" is useful for testing them. This could close the issue https://gitlab.kitware.com/cmake/cmake/issues/13487.

Harry

================================================
    find_path(KERNEL_INCLUDE_DIR IOKit/pci/IOPCIDevice.h)

    add_library(driver MODULE
        Kext.cpp
        Kext.h
    )

    target_include_directories(driver
        PRIVATE ${KERNEL_INCLUDE_DIR}
    )

    set(driver_name "Driver")
    set(driver_id "com.driver.driver")
    set(driver_version "1.0.0")

    set_target_properties(driver PROPERTIES
        BUNDLE YES
        BUNDLE_EXTENSION kext
        INSTALL_RPATH "" # rpath must not be set!
        MACOSX_BUNDLE_BUNDLE_NAME ${driver_name}
        MACOSX_BUNDLE_BUNDLE_VERSION ${driver_version}
        MACOSX_BUNDLE_GUI_IDENTIFIER ${driver_id}
        MACOSX_BUNDLE_INFO_PLIST CmakeTemplate.plist.in
        OUTPUT_NAME ${driver_name}
        XCODE_ATTRIBUTE_MODULE_NAME ${driver_id}
        XCODE_ATTRIBUTE_MODULE_VERSION ${driver_version}
        XCODE_PRODUCT_TYPE "com.apple.product-type.kernel-extension.iokit"
    )

    install(TARGETS driver
        DESTINATION Library/Extensions
        COMPONENT driver
    )

    # Now we do a signing routine which we rolled ourselves

================================================


Harry Mallon

CODEX | Software Engineer

60 Poland Street | London | England | W1F 7NT

E harry at codexdigital.com<mailto:harry at codexdigital.com> | T +44 203 7000 989<callto:+44%20203%207000%20989>

Website<http://codex.online> | Facebook<https://www.facebook.com/codexdigital> | Twitter<http://twitter.com/codexdigital>

[http://codex.online/?action=asset&id=5B21DF7C-EC27-4199-852F-D596F5F28DA9]<http://codex.online>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170117/4185c680/attachment.html>


More information about the CMake mailing list