Search code examples
ioscmakefirebreath

Cannot add files to the bundle Cmake


I want to add two files inside MyPlugin.plugin directory.

I follow the instructions provided here but files are not added in the directory. I have also tried to add them in "Contents" directory and failed. What I managed to do is add them inside "Resources/English.lproj" directory.

The structure is the following:

      MyPlugin.plugin/
                     Contents/
                             Info.plist
                             MacOS/
                                  file1 
                             Resources/
                                      English.lproj/
                                                   InfoPlist.strings
                                                   Localized.rsrc

The code that I add inside projectDef.cmake in order to add files inside MyPlugin.plugin is:

file (GLOB MAC_FILES ${CMAKE_CURRENT_SOURCE_DIR}
  MacFiles/file1
  MacFiles/file2
) 
set_source_files_properties(
  ${MAC_FILES}
  PROPERTIES
  MACOSX_PACKAGE_LOCATION "MyPlugin.plugin"
 )

 SOURCE_GROUP(Mac FILES ${PLATFORM})

 set (SOURCES
   ${SOURCES}
   ${PLATFORM}
   ${MAC_FILES}
 )

I should mention that I use the same code to add files inside Resources/English.lproj, only changing line:

 MACOSX_PACKAGE_LOCATION "Resources/English.lproj"

Solution

  • Most likely you need a package location of "" or perhaps "/"; this should be the location inside the bundle, not the name of the bundle itself.