View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015125CMakeCMakepublic2014-09-03 08:472015-03-02 08:57
ReporterJan Rüegg 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.0.1 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0015125: XCode generator cannot add assetcatalog assets
DescriptionWhen adding resources to an XCode CMake project like this:

set_target_properties(foo PROPERTIES RESOURCE example/demo_app/Images.xcassets)

An entry similar to this one is created in the xcode project:

1582C9DBB34F4291A1D09CA3 /* Images.xcassets */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = folder; name = Images.xcassets; path = example/demo_app/Images.xcassets; sourceTree = SOURCE_ROOT; };

This works fine for normal folders, however I would like to use this to add an assets folder. This creates a very similar entry, however to make it work with xcode the lastKnownFileType needs to be changed from "folder" to "folder.assetcatalog", like this:

1582C9DBB34F4291A1D09CA3 /* Images.xcassets */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/demo_app/Images.xcassets; sourceTree = SOURCE_ROOT; };

In CMake 3.0.1, this is generated in the file "cmGlobalXCodeGenerator.cxx", line 874:
  if(cmSystemTools::FileIsDirectory(fullpath.c_str()))
    {
    fileRef->AddAttribute("lastKnownFileType",
                          this->CreateString("folder"));
    }
In order to make it work, it would need to be changed to read something like this (pseudocode):
  if(cmSystemTools::FileIsDirectory(fullpath.c_str()))
    {
      if (fileEndsWith(".xcassets"))
        {
          fileRef->AddAttribute("lastKnownFileType",
                        this->CreateString("folder.assetcatalog"));
        }
        else
        {
          fileRef->AddAttribute("lastKnownFileType",
                        this->CreateString("folder"));
        }
    }
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036707)
Jan Rüegg (reporter)
2014-09-03 08:48

For reference, this is what I'm talking about:
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html#//apple_ref/doc/uid/TP40013303-CH1-SW1 [^]
(0036723)
Brad King (manager)
2014-09-03 11:32

This should fix it:

 Xcode: Refactor internal file type extension extraction
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02aa5965 [^]

 Xcode: Reference '.xcassets' folders as assetcatalog
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8eacc339 [^]

FYI, starting in CMake 3.1 there will be source file properties to override this information without waiting for an update to CMake to do it by default:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Help/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE.rst;hb=fb8acb74 [^]
 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Help/prop_sf/XCODE_EXPLICIT_FILE_TYPE.rst;hb=fb8acb74 [^]
(0038105)
Robert Maynard (manager)
2015-03-02 08:57

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-09-03 08:47 Jan Rüegg New Issue
2014-09-03 08:48 Jan Rüegg Note Added: 0036707
2014-09-03 11:32 Brad King Note Added: 0036723
2014-09-03 11:32 Brad King Assigned To => Brad King
2014-09-03 11:32 Brad King Status new => assigned
2014-09-03 11:32 Brad King Target Version => CMake 3.1
2014-09-04 09:45 Brad King Status assigned => resolved
2014-09-04 09:45 Brad King Resolution open => fixed
2014-09-04 09:45 Brad King Fixed in Version => CMake 3.1
2015-03-02 08:57 Robert Maynard Note Added: 0038105
2015-03-02 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team