[CMake] installing resources in mac app on cmake 2.6

Mattias Holm mattias.holm at contra.nu
Mon Apr 7 15:12:59 EDT 2008


Hi,

Thanks, will try that out, however, what I was trying was something  
like the following:

add_executable(openorbit MACOSX_BUNDLE ${openorbit_SRC})
set_target_properties(openorbit PROPERTIES RESOURCE ${res_list})

I assume then that setting the resource property on a target only  
works on frameworks (and not applications), this is a bit inconsistent  
I think.


Regards,
Mattias

On 7 Apr 2008, at 18:55, David Cole wrote:

> This is a snippet from the CMake source tree, in the file CMake/ 
> Tests/BundleTest/CMakeLists.txt :
>
> <snippet>
> SET_SOURCE_FILES_PROPERTIES(
>   "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
>   PROPERTIES
>   MACOSX_PACKAGE_LOCATION Resources
>   )
>
> SET_SOURCE_FILES_PROPERTIES(
>   SomeRandomFile.txt
>   "${CMake_SOURCE_DIR}/ChangeLog.txt"
>   PROPERTIES
>   MACOSX_PACKAGE_LOCATION MacOS
>   )
>
> SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
>
> # Test building a bundle linking to a shared library.
> ADD_LIBRARY(BundleTestLib SHARED BundleLib.cxx)
> ADD_EXECUTABLE(BundleTest
>   MACOSX_BUNDLE
>   BundleTest.cxx
>   SomeRandomFile.txt
>   "${CMake_SOURCE_DIR}/ChangeLog.txt"
>   "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
>   )
> </snippet>
>
>
> It should be as simple as adding the resource files as sources to  
> your executable that has the MACOSX_BUNDLE flag on and then:
>
> SET_SOURCE_FILES_PROPERTIES(
>   "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
>   PROPERTIES
>   MACOSX_PACKAGE_LOCATION Resources
>   )
>
> When you have the MACOSX_PACKAGE_LOCATION set and the file is added  
> as a source, it should be copied into the .app bundle during a  
> "make" (or a build with Xcode).
>
>
> HTH,
> David
>
>
> On Mon, Apr 7, 2008 at 12:16 PM, Mattias Holm  
> <mattias.holm at contra.nu> wrote:
> Hi,
>
> I asked about this before, but i think it was lost in all the other  
> talk of cmake 2.6 at that moment.
>
> How do I ensure that resources added to the resource list of an  
> application is installed in the MacOS X application bundle?
>
> Will it be done during the normal build (i.e. without typing make  
> install), and will it in that case avoid copying files if they have  
> not changed (some resource files can be quite heavy).
>
> I tried adding the resource files to the the application, but they  
> were not installed in the app bundle on a plain "make".
>
> Do I need to do something with the install command as well?
>
>
> / Mattias
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080407/e8ab9b24/attachment.htm>


More information about the CMake mailing list