cmake/Help/prop_tgt/RESOURCE.rst

59 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
RESOURCE
--------
2016-03-13 13:35:51 +01:00
Specify resource files in a :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE`.
Target marked with the :prop_tgt:`FRAMEWORK` or :prop_tgt:`BUNDLE` property
2018-10-28 12:09:07 +01:00
generate framework or application bundle (both macOS and iOS is supported)
2016-03-13 13:35:51 +01:00
or normal shared libraries on other platforms.
This property may be set to a list of files to be placed in the corresponding
2018-10-28 12:09:07 +01:00
directory (eg. ``Resources`` directory for macOS) inside the bundle.
2016-03-13 13:35:51 +01:00
On non-Apple platforms these files may be installed using the ``RESOURCE``
2019-11-11 23:01:05 +01:00
option to the :command:`install(TARGETS)` command.
2016-03-13 13:35:51 +01:00
Following example of Application Bundle:
.. code-block:: cmake
add_executable(ExecutableTarget
addDemo.c
resourcefile.txt
2019-11-11 23:01:05 +01:00
appresourcedir/appres.txt)
2016-03-13 13:35:51 +01:00
target_link_libraries(ExecutableTarget heymath mul)
set(RESOURCE_FILES
resourcefile.txt
2019-11-11 23:01:05 +01:00
appresourcedir/appres.txt)
2016-03-13 13:35:51 +01:00
set_target_properties(ExecutableTarget PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
2019-11-11 23:01:05 +01:00
RESOURCE "${RESOURCE_FILES}")
2016-03-13 13:35:51 +01:00
will produce flat structure for iOS systems::
ExecutableTarget.app
appres.txt
ExecutableTarget
Info.plist
resourcefile.txt
2018-10-28 12:09:07 +01:00
For macOS systems it will produce following directory structure::
2016-03-13 13:35:51 +01:00
ExecutableTarget.app/
Contents
Info.plist
MacOS
ExecutableTarget
Resources
appres.txt
resourcefile.txt
2019-11-11 23:01:05 +01:00
For Linux, such CMake script produce following files::
2016-03-13 13:35:51 +01:00
ExecutableTarget
Resources
appres.txt
resourcefile.txt