View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013487CMakeCMakepublic2012-08-22 16:312016-06-10 14:31
ReporterBill Stouder-Studenmund 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformMacOSOS XOS VersionN/A
Product VersionCMake 2.8.8 
Target VersionFixed in Version 
Summary0013487: CMake can't make kexts
DescriptionCMake can build targets which are apps, but it can't make kexts (kernel modules). Fix isn't hard.
Additional InformationI have gotten CMake to generate kexts that work. The issue that MUST be fixed in-code is that kexts have an extension of ".kext" while OS X bundles currently are hard-coded to be ".app".

As a work-around, my CMakeLists.txt has:

      set(SLE System/Library/Extensions)
      ...
      install(TARGETS myKext BUNDLE DESTINATION /${SLE} )
      install(CODE "file(RENAME ${DSTROOT}/${SLE}/myKext.app ${DSTROOT}/${SLE}/myKext.kext)")

I don't know how to fix this, but I suggest two new target properties for an OS X bundle:

   MACOSX_BUNDLE_EXTENSION # defaults to "app"
   MACOSX_BUNDLE_TYPE # type in the Info.plist, defaults to "APPL"


Generating a kext did also require some custom link options:

      set_target_properties(myKext PROPERTIES LINKER_LANGUAGE C)
      set_target_properties(myKext PROPERTIES LINK_FLAGS "-Xlinker -kext -lcc_kext")

but these were achievable within the existing set of settings. I also am not sure exactly which of those are needed; my project has been updated over time and may not use the recommended starting settings. Also, we mix C and C++ (IOKit).
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0030742)
David Cole (manager)
2012-08-22 16:42

You should be able to do this already with:

  set_property(TARGET module_name PROPERTY BUNDLE 1)
  set_property(TARGET module_name PROPERTY BUNDLE_EXTENSION "kext")

  http://cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:BUNDLE [^]
  http://cmake.org/cmake/help/v2.8.9/cmake.html#prop_tgt:BUNDLE_EXTENSION [^]

Give that a try, and let me know if there are other problems with that approach.
(0030744)
Bill Stouder-Studenmund (reporter)
2012-08-22 17:29

I tweaked my CMakeLists.txt to contain:


      add_executable(myKext MACOSX_BUNDLE ${MY_KEXT_SOURCES} myIcon.icns)
 
      set_property(TARGET myKext PROPERTY BUNDLE 1)
      set_property(TARGET myKext PROPERTY BUNDLE_EXTENSION kext)
      set_target_properties(myKext PROPERTIES LINKER_LANGUAGE C)
      set_target_properties(myKext PROPERTIES LINK_FLAGS "-Xlinker -kext -lcc_kext")


      set_source_files_properties(myIcon.icns
         PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

      set_target_properties(myKext PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/myKextInfo.plist.tmpl)

      install(TARGETS myKext BUNDLE DESTINATION /${SLE} )

and ls still shows myKext.app
(0030745)
David Cole (manager)
2012-08-22 21:34

Ah... looking at the code, it appears that only "MODULE" libraries are affected by these properties.

If 'kext' is an executable, then CMake code changes are necessary to build those.

We'll leave this bug open for a bit and see if anybody can come up with a patch to CMake to fix it.

Thanks for the report.
(0042108)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2012-08-22 16:31 Bill Stouder-Studenmund New Issue
2012-08-22 16:39 David Cole Assigned To => David Cole
2012-08-22 16:39 David Cole Status new => assigned
2012-08-22 16:42 David Cole Note Added: 0030742
2012-08-22 17:29 Bill Stouder-Studenmund Note Added: 0030744
2012-08-22 21:34 David Cole Note Added: 0030745
2012-08-22 21:35 David Cole Assigned To David Cole =>
2012-08-22 21:35 David Cole Status assigned => new
2016-06-10 14:28 Kitware Robot Note Added: 0042108
2016-06-10 14:28 Kitware Robot Status new => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team