[cmake-developers] Create subdirectories in Resource directory for Frameworks and Application bundle.

Bartosz Kosiorek Bartosz.Kosiorek at tomtom.com
Fri Dec 11 12:01:41 EST 2015


Thanks Clint

Unfortunately MACOSX_PACKAGE_LOCATION is not working correctly with RESOURCE property.
For every resource which is marked as RESOURCE, will be placed in root "Resources" directory.

The CMake code below create following directory structure for OS X:

── mul.framework
    ├── Headers -> Versions/Current/Headers
    ├── Resources -> Versions/Current/Resources
    ├── Versions
    │   ├── A
    │   │   ├── Headers
    │   │   │   └── mul.h
    │   │   ├── Modules
    │   │   │   └── module.modulemap
    │   │   ├── Resources
    │   │   │   ├── Info.plist
    │   │   │   ├── mulres.txt
    │   │   │   ├── pl.txt
    │   │   │   └── resourcefile.txt
    │   │   ├── lang
    │   │   │   └── en.txt
    │   │   └── mul
    │   └── Current -> A
    └── mul -> Versions/Current/mul


As you can see eveything which is marked as "RESOURCE" will be placed in Versions/A/ directory
My expectation will be that lang/pl.txt and lang/en.txt should be in Resources/lang/ directory.
Here is complete directory structure:

── mul.framework
    ├── Headers -> Versions/Current/Headers
    ├── Resources -> Versions/Current/Resources
    ├── Versions
    │   ├── A
    │   │   ├── Headers
    │   │   │   └── mul.h
    │   │   ├── Modules
    │   │   │   └── module.modulemap
    │   │   ├── Resources
    │   │   │   ├── Info.plist
    │   │   │   ├── mulres.txt
    │   │   │   ├── lang
    │   │   │   │   └── pl.txt
    │   │   │   │   └── en.txt
    │   │   │   └── resourcefile.txt
    │   │   ├── lang
    │   │   │   └── en.txt
    │   │   └── mul
    │   └── Current -> A
    └── mul -> Versions/Current/mul


What do you think about that?

Here is the source code:

set_property(SOURCE module.modulemap
  PROPERTY MACOSX_PACKAGE_LOCATION "Modules")

set_property(
  SOURCE lang/en.txt lang/pl.txt
  PROPERTY MACOSX_PACKAGE_LOCATION "lang")

set(RESLIST 
    mulres.txt
    lang/pl.txt
    resourcefile.txt
    )

add_library(mul SHARED 
            mul.c
            mul.h
            module.modulemap
            lang/pl.txt
            lang/en.txt
            resourcefile.txt
            mulres.txt)

# Create an iOS Framework bundle 
set_target_properties(mul PROPERTIES
  FRAMEWORK TRUE
  MACOSX_FRAMEWORK_IDENTIFIER org.cmake.mul
  MACOSX_FRAMEWORK_SHORT_VERSION_STRING 42
  MACOSX_FRAMEWORK_BUNDLE_VERSION 3.2.10
  XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
  PUBLIC_HEADER mul.h
  RESOURCE "${RESLIST}"
)

Thanks in advance 
Bartosz


________________________________________
From: clinton at elemtech.com <clinton at elemtech.com>
Sent: Friday, December 11, 2015 4:24 PM
To: Brad King
Cc: Bartosz Kosiorek; cmake-developers; Gregor Jasny
Subject: Re: [Apple/iOS/OS X] Create subdirectories in Resource directory for Frameworks and Application bundle.

----- On Dec 11, 2015, at 7:36 AM, Brad King brad.king at kitware.com wrote:

> On 12/10/2015 09:52 AM, Bartosz Kosiorek wrote:
>> How it is officialy supported to tell CMake to create subdirectories
>> inside "Resources" directory?
>
> I'm not particularly familiar with this infrastructure myself, but I
> do not know of any way to define such a layout now.  A new interface
> may have to be designed and implemented to achieve this.
>
> -Brad


This may not be what you are looking for.
You can place files in a bundle/framework at certain locations.
Perhaps in subdirectories under Resources/.
https://cmake.org/cmake/help/v3.4/prop_sf/MACOSX_PACKAGE_LOCATION.html

Clint


More information about the cmake-developers mailing list