[CMake] [iOS] What is the correct way to add resources to an XCode project

Ruslan Baratov ruslan_baratov at yahoo.com
Tue Jun 28 19:48:29 EDT 2016


Hi,

I have used two approaches which is not based on assets directories.

First is to save icons to resources with special names. In this case 
Xcode will add them automatically, see:
* 
https://github.com/forexample/testapp/blob/9202304134862f043af740af27dc7efb3b3f565d/CMakeLists.txt#L28

Second is to save icons to resources too, but you can control names of 
pictures. You have to update *.plist file in this case.
* custom names: 
https://github.com/ruslo/weather/blob/56eee62eaac327e1a048165aaa868c2f3a71972f/Source/weather/ui/ios/icons/app/sugar.cmake#L15
* plist file: 
https://github.com/ruslo/weather/blob/56eee62eaac327e1a048165aaa868c2f3a71972f/Source/weather/ui/ios/views/plist.in#L35
* adding to resources: 
https://github.com/ruslo/weather/blob/56eee62eaac327e1a048165aaa868c2f3a71972f/Source/weather/ui/ios/CMakeLists.txt#L49

Also according to my reverse engineering skills next xcode variables 
used to define assets directories for icons and launch images:
* ASSETCATALOG_COMPILER_APPICON_NAME
* ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME

This means you can experiment with target properties:
* XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME
* XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME

I have never used them before, so have no idea about it's working or not.

Ruslo

On 29-Jun-16 00:01, Roman Wüger wrote:
> No one?
>
> The target property RESOURCE does only allow files but no directories.
>
> Regards
> Roman
>
>
>> Am 22.06.2016 um 17:22 schrieb Roman Wüger <roman.wueger at gmx.at>:
>>
>> Hello,
>>
>> I read the mailing list but did find a way which works.
>>
>> At the moment I use Xcode 7.3.1 and CMake 3.5.2 which creates a project for iOS 9.3.
>>
>> All I want is to add the directory "Images.xcassets" and a second directory structure to be copied to the Resource folder listed in XCode.
>>
>> When I manually drag'n drop the directories into the Resource folder as reference or as group everything is working. How can I archive this with CMake?
>>
>> Thanks and regards
>> Roman
>> -- 
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake




More information about the CMake mailing list