MantisBT - CMake
View Issue Details
0015487CMakeCMakepublic2015-04-01 12:212015-12-19 15:41
Gregor Jasny 
Gregor Jasny 
normalminoralways
closedfixed 
AppleMac OS X10.10.2
CMake 3.2.1 
CMake 3.3 
0015487: Leading double slashes in path cause unparsable Xcode project
If the project source path start with a double slash the resulting Xcode project cannot be parsed by Xcode.

I got the double slash at the beginning because my build orchestration script tries to normalize the source path by calling "pwd -P".

So this:
$ pwd
/Volumes/Macintosh HD/Users/jasny/src/pathbug

was translated into

$ pwd -P
//Users/jasny/src/pathbug

and passed to cmake invocation.

Multiple slashes are discussed here:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11 [^]

A pathname consisting of a single slash shall resolve to the root directory of the process. A null pathname shall not be successfully resolved. A pathname that begins with two successive slashes may be interpreted in an implementation-defined manner, although more than two leading slashes shall be treated as a single slash.

I thought about adding a kind of normalization which replaces multiple slashes with one but I'm unsure if this should be done globally or just in the Xcode generator. I will also file a bug report with Apple.
project(Foo CXX)
add_library(foo STATIC foo.cpp)

cmake -GXcode //path/to/source

open Foo.xcodeproj

Result:
Project /Users/jasny/src/pathbug/build/Foo.xcodeproj cannot be opened because the project file cannot be parsed.
No tags attached.
Issue History
2015-04-01 12:21Gregor JasnyNew Issue
2015-04-01 12:48Gregor JasnyNote Added: 0038382
2015-04-01 13:21Brad KingAssigned To => Gregor Jasny
2015-04-01 13:21Brad KingStatusnew => assigned
2015-04-01 13:21Brad KingNote Added: 0038384
2015-04-04 16:21Gregor JasnyNote Added: 0038404
2015-04-06 10:19Brad KingNote Added: 0038450
2015-12-19 15:41Gregor JasnyStatusassigned => resolved
2015-12-19 15:41Gregor JasnyFixed in Version => CMake 3.3
2015-12-19 15:41Gregor JasnyResolutionopen => fixed
2015-12-19 15:41Gregor JasnyStatusresolved => closed

Notes
(0038382)
Gregor Jasny   
2015-04-01 12:48   
Quoting the path like

469770D01ACC562F003570AC /* foo.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = foo.txt; path = "//tmp/foo.txt"; sourceTree = "<absolute>"; };

seems to do the trick. I will work on a patch.
(0038384)
Brad King   
2015-04-01 13:21   
Thanks. FYI, CMake interprets a leading double slash to mean that it is a network path of the form //machine/share.
(0038404)
Gregor Jasny   
2015-04-04 16:21   
Pushed a simple fix to xcode-quote-path topic.
(0038450)
Brad King   
2015-04-06 10:19   
Re 0015487:0038404: Thanks. That looks like the correct fix for this. Please merge to 'next' for testing.