RESOURCE.rst 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. RESOURCE
  2. --------
  3. Specify resource files in a :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE`.
  4. Target marked with the :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE` property
  5. generate framework or application bundle (both OS X and iOS is supported)
  6. or normal shared libraries on other platforms.
  7. This property may be set to a list of files to be placed in the corresponding
  8. directory (eg. ``Resources`` directory for OS X) inside the bundle.
  9. On non-Apple platforms these files may be installed using the ``RESOURCE``
  10. option to the ``install(TARGETS)`` command.
  11. Following example of Application Bundle:
  12. .. code-block:: cmake
  13. add_executable(ExecutableTarget
  14. addDemo.c
  15. resourcefile.txt
  16. appresourcedir/appres.txt
  17. )
  18. target_link_libraries(ExecutableTarget heymath mul)
  19. set(RESOURCE_FILES
  20. resourcefile.txt
  21. appresourcedir/appres.txt
  22. )
  23. set_target_properties(ExecutableTarget PROPERTIES
  24. MACOSX_BUNDLE TRUE
  25. MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
  26. RESOURCE "${RESOURCE_FILES}"
  27. )
  28. will produce flat structure for iOS systems::
  29. ExecutableTarget.app
  30. appres.txt
  31. ExecutableTarget
  32. Info.plist
  33. resourcefile.txt
  34. For OS X systems it will produce following directory structure::
  35. ExecutableTarget.app/
  36. Contents
  37. Info.plist
  38. MacOS
  39. ExecutableTarget
  40. Resources
  41. appres.txt
  42. resourcefile.txt
  43. For Linux, such cmake script produce following files::
  44. ExecutableTarget
  45. Resources
  46. appres.txt
  47. resourcefile.txt