View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014498 | CMake | CMake | public | 2013-10-21 05:51 | 2014-03-05 09:58 | ||||
Reporter | Michael Priestman | ||||||||
Assigned To | Brad King | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | Apple | OS | Mac OS X | OS Version | 10.8.5 | ||||
Product Version | CMake 2.8.12 | ||||||||
Target Version | CMake 3.0 | Fixed in Version | CMake 3.0 | ||||||
Summary | 0014498: Folder references aren't added correctly to Xcode projects. | ||||||||
Description | With the change that fixed issue 0014093, another issue has arisen. If you try to add a folder reference into an Xcode project, then the incorrect file type is set on the reference, and Xcode cannot access the files inside the folder, saying instead that it has no permissions. I have a folder that contains some image assets for an iOS project, and I want to just add the entire folder (which has subfolders) to an Xcode project. I do this by just including the path to the folder. With CMake 2.8.11.02, this worked fine. But with the change mentioned above, the reference now has an "explicitFileType" attribute, which is set to "sourcecode". It appears Xcode isn't happy with this. If you add a folder reference to an Xcode project, I think the explicitFileType attribute should be set to "folder". I discovered this by explicitly setting the file type in Xcode to "Directory" and resaving the project. If you do this, then Xcode can once again access the contents of the folder. So whilst technically this could be a bug with Xcode (tested with 4 and 5, same behaviour), I don't think it should be too hard to fix in CMake. If you can tell a given source file reference is actually a folder reference, then you can just say the explicitFileType is "folder" instead of "sourcecode". This isn't a major issue as if you want to access the folder in Xcode, you can just manually update the file type, but obviously you'd have to do that each time you regenerate the project. | ||||||||
Steps To Reproduce | Create a directory that contains a simple source file and single folder that contains, say, an image. Create a simple CMake file that defines a library that contains a reference to the folder. Generate an XCode project from the CMake file. Load XCode project, and try to navigate to the folder. You will get an error. Set the file type to "Directory", then you can access the contents of the folder. Attached is a sample that demonstrates this problem. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | sample.zip [^] (64,472 bytes) 2013-10-21 05:51 0001-Updated-Xcode-generator-to-set-lastKnownFileType-to-.patch [^] (2,191 bytes) 2013-10-21 10:57 [Show Content] | ||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0034181) Brad King (manager) 2013-10-21 08:55 |
Take a look at the logic here: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalXCodeGenerator.cxx;hb=v2.8.12#l844 [^] Try adding a test for cmSystemTools::FileIsDirectory(fullpath) to change the explicitFileType value. |
(0034188) Jamie Snape (reporter) 2013-10-21 09:52 |
I can reproduce the issue with Xcode 5.0.1. Setting explicitFileType = folder in the pbxproj does indeed resolve the issue for me. See also Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/Frameworks/DevToolsCore.framework/Versions/A/Resources/Built-in file types.pbfilespec |
(0034192) Michael Priestman (reporter) 2013-10-21 10:27 |
I've just tried setting explicitFileType to be folder, and on Xcode 4.6.1, this didn't work. I had to set "lastKnownFileType" to be "folder" in order to get it working. I can try Xcode 5.0.1 as well and see if this is something dependent on Xcode version. |
(0034193) Michael Priestman (reporter) 2013-10-21 10:31 |
Alternatively, just not setting lastKnownFileType or explicitFileType also fixes the problem, but not sure what other implications this would have. So maybe best to just set lastKnownFileType to "folder". |
(0034197) Jamie Snape (reporter) 2013-10-21 10:39 |
Sorry, you're correct, I should have said lastKnownFileType = folder On further investigation, setting the file type in the GUI for folders corresponds to "lastKnownFileType" rather than "explicitFileType". |
(0034199) Brad King (manager) 2013-10-21 10:42 |
Re 0014498:0034197: That's why we used to generate lastKnownFileType, but behavior in 0014093 said differently. Please try the approach I suggested in 0014498:0034181 to use lastKnownFileType=folder for directories and keep the current behavior otherwise. |
(0034201) Michael Priestman (reporter) 2013-10-21 10:49 |
Yep, that's what I have just tried. I have a patch for master that I think fixes this problem. What would be the next steps? I've never contributed anything to the CMake project before. I could attach the patch to this report for testing by other people? |
(0034203) Jamie Snape (reporter) 2013-10-21 10:55 edited on: 2013-10-21 10:56 |
Re 0014498:0034199: The behavior of the GUI with respect to folders is apparently different than with files. The behavior in 0014093 is otherwise correct as Xcode is still basically ignoring lastKnownFileType for files. |
(0034204) Brad King (manager) 2013-10-21 10:56 |
Re 0014498:0034201: Great, please use "git format-patch" to export the patch and attach the file here. Please explain in the commit message what we know about why this is needed. Thanks! |
(0034205) Michael Priestman (reporter) 2013-10-21 11:01 |
Patch attached. I have updated the function you mentioned to add the "lastKnownFileType" attribute if it's a folder, otherwise use the existing code. Had to also put a check in for "explicitFileType" attribute in CreateXCodeTargets as now it might not be present. Think this behaviour makes sense as folders should never be classified as externalObjFiles. |
(0034211) Brad King (manager) 2013-10-21 11:31 |
Re 0014498:0034205: Patch applied with minor tweaks: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e5ec8ad4 [^] |
(0035293) Robert Maynard (manager) 2014-03-05 09:58 |
Closing resolved issues that have not been updated in more than 4 months |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-10-21 05:51 | Michael Priestman | New Issue | |
2013-10-21 05:51 | Michael Priestman | File Added: sample.zip | |
2013-10-21 08:52 | Brad King | Relationship added | related to 0014093 |
2013-10-21 08:55 | Brad King | Note Added: 0034181 | |
2013-10-21 09:52 | Jamie Snape | Note Added: 0034188 | |
2013-10-21 10:27 | Michael Priestman | Note Added: 0034192 | |
2013-10-21 10:31 | Michael Priestman | Note Added: 0034193 | |
2013-10-21 10:39 | Jamie Snape | Note Added: 0034197 | |
2013-10-21 10:42 | Brad King | Note Added: 0034199 | |
2013-10-21 10:49 | Michael Priestman | Note Added: 0034201 | |
2013-10-21 10:55 | Jamie Snape | Note Added: 0034203 | |
2013-10-21 10:56 | Jamie Snape | Note Edited: 0034203 | |
2013-10-21 10:56 | Brad King | Note Added: 0034204 | |
2013-10-21 10:56 | Jamie Snape | Note Edited: 0034203 | |
2013-10-21 10:57 | Michael Priestman | File Added: 0001-Updated-Xcode-generator-to-set-lastKnownFileType-to-.patch | |
2013-10-21 11:01 | Michael Priestman | Note Added: 0034205 | |
2013-10-21 11:31 | Brad King | Note Added: 0034211 | |
2013-10-21 11:32 | Brad King | Assigned To | => Brad King |
2013-10-21 11:32 | Brad King | Status | new => resolved |
2013-10-21 11:32 | Brad King | Resolution | open => fixed |
2013-10-21 11:32 | Brad King | Fixed in Version | => CMake 3.0 |
2013-10-21 11:32 | Brad King | Target Version | => CMake 3.0 |
2014-03-05 09:58 | Robert Maynard | Note Added: 0035293 | |
2014-03-05 09:58 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |