summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt/RESOURCE.rst
blob: d837f7b33f21beb46f676e6e4e8b983fa047fea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
RESOURCE
--------

Specify resource files in a :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE`.

Target marked with the :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE` property
generate framework or application bundle (both OS X and iOS is supported)
or normal shared libraries on other platforms.
This property may be set to a list of files to be placed in the corresponding
directory (eg. ``Resources`` directory for OS X) inside the bundle.
On non-Apple platforms these files may be installed using the ``RESOURCE``
option to the ``install(TARGETS)`` command.

Following example of Application Bundle:

.. code-block:: cmake

  add_executable(ExecutableTarget
    addDemo.c
    resourcefile.txt
    appresourcedir/appres.txt
  )

  target_link_libraries(ExecutableTarget heymath mul)

  set(RESOURCE_FILES
    resourcefile.txt
    appresourcedir/appres.txt
  )

  set_target_properties(ExecutableTarget PROPERTIES
    MACOSX_BUNDLE TRUE
    MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
    RESOURCE "${RESOURCE_FILES}"
  )

will produce flat structure for iOS systems::

  ExecutableTarget.app
    appres.txt
    ExecutableTarget
    Info.plist
    resourcefile.txt

For OS X systems it will produce following directory structure::

  ExecutableTarget.app/
    Contents
      Info.plist
      MacOS
        ExecutableTarget
      Resources
        appres.txt
        resourcefile.txt

For Linux, such cmake script produce following files::

  ExecutableTarget
  Resources
    appres.txt
    resourcefile.txt