MantisBT - CMake
View Issue Details
0015676CMakeCMakepublic2015-08-03 05:332016-06-10 14:31
Adn 
Kitware Robot 
normalminoralways
closedmoved 
AppleOS X10.9
CMake 3.3 
 
0015676: The red message "INSTALL TARGETS - target Xxx has RESOURCE files but no RESOURCE DESTINATION." is misleading on Apple platforms.
When building an OS X application, the resource files are listed in the RESOURCE target property. Following INSTALL(...) documentation (http://www.cmake.org/cmake/help/v3.3/command/install.html?highlight=install#installing-targets [^]):

>The PRIVATE_HEADER, PUBLIC_HEADER, and RESOURCE arguments cause subsequent properties to be applied to installing a FRAMEWORK shared library target’s associated files on non-Apple platforms.
>Rules defined by these arguments are ignored on Apple platforms because the associated files are installed into the appropriate locations inside the framework folder.

From the documentation, one would understand that there is no point in giving a RESOURCE argument to INSTALL command when targeting Apple platforms: the argument is ignored, and the resource are copied inside the bundle (the second statement here being actually true). Yet, if this argument is omitted, a red message is emitted in the GUI, which seems confusing with regard to the documentation statement.

Also, if one decides to provide this argument with a dummy location to turn off the message, the install target will actually copy the RESOURCE files to the dummy location (So the argument is not ignored: the resources are still copied in the bundle, but they are also copied in the provided location).
##
## This is the skeleton of a CMakeLists.txt that would trigger the red message when generated on Apple
##

# populate ${${PROJECT_NAME}_RESOURCES} variable with a .xib file and images

add_executable(${PROJECT_NAME} MACOSX_BUNDLE
    ${${PROJECT_NAME}_HEADERS}
    ${${PROJECT_NAME}_SOURCES}
    ${${PROJECT_NAME}_RESOURCES}
    main.mm
)

set_target_properties(${PROJECT_NAME} PROPERTIES
                      VERSION "${VERSION}"
                      SOVERSION "${SOVERSION}"
                      RESOURCE "${${PROJECT_NAME}_RESOURCES}"
)

install(TARGETS ${PROJECT_NAME}
        BUNDLE DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}
)
There is a stack overflow question on this topic:
http://stackoverflow.com/q/31723271/1027706 [^]
No tags attached.
Issue History
2015-08-03 05:33AdnNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042815
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042815)
Kitware Robot   
2016-06-10 14:29   
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.