MantisBT - CMake
View Issue Details
0011244CMakeCMakepublic2010-09-18 09:472010-10-06 13:45
Mikkel Krautz 
Brad King 
normalminoralways
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011244: Using Xcode built-in variables as CMAKE_OSX_ARCHITECTURES
Hi,

I've recently begun using CMake for some of my iPhone projects as a way having a more explicit build process (i.e I use CMake to generate my .xcodeprojs so I don't have to fiddle with the Xcode GUI to change build settings).

For these projects it is desirable for me to use the built-in $(ARCHS_STANDARD_32_BIT) to allow the projects to be built both for the iPhone Simulator and for devices. This way, the correct architectures will be used for both of these settings.

However, I've run into a couple of problems using these built-ins from within CMake.

The first problem is that not all ARCHS values in the generated project are properly quoted when using these built-ins. In some places in the file, I would get lines such as:

   ARCHS = $(ARCHS_STANDARD_32_BIT);

Which makes Xcode think the project file is broken. I've tried to fix this in my CMake fork on GitHub by forcing strings containing '$' to be quoted:

http://github.com/mkrautz/CMake/commit/f8319b97c7caaeaca907a28cdffa30228622be3c [^]

I'm not sure if this is the correct fix for this, but it works.


The other issue is a bit different. Not all of the ARCH values in the project file would be missing the quotes. Ones generated by cmGlobalXCodeGenerator::CreateXCodeObjects would have the quotes, because it does this:

 std::string archString;
 for( std::vector<std::string>::iterator i = this->Architectures.begin();
        i != this->Architectures.end(); ++i) {
      archString += *i;
      archString += " ";
 }

The result here is that the ARCH value in the generated project file would have a space appended to it. (This is OK, because without the patch above, not having a space in there would make it not quoted!)

The real issue is that Xcode doesn't recognize its built-ins in the UI if there's a space at the end. So even though ARCHS = "$(ARCHS_STANDARD_32_BIT) ", it would show up as:

  Architectures | $(ARCHS_STANDARD_32_BIT)

instead of:

  Architectures | Standard (armv6, armv7)

I've also committed a "fix" for this issue in my CMake fork on GitHub:

http://github.com/mkrautz/CMake/commit/0815b7b9e327a31441770fbef9ebedf12a552964 [^]


Again, I'm not sure if these are the correct fixes for the problems at hand, but they work around the issues that I've been seeing with the CMAKE_OSX_ARCHITECTURES variable.
No tags attached.
has duplicate 0011259closed David Cole Setting CMAKE_OSX_ARCHITECTURES Produces Invalid Xcode Project File 
related to 0007932closed Bill Hoffman XCode Source Grouping doesn't allow for multiple levels of source groups 
Issue History
2010-09-18 09:47Mikkel KrautzNew Issue
2010-09-20 09:49Bill HoffmanStatusnew => assigned
2010-09-20 09:49Bill HoffmanAssigned To => Brad King
2010-09-20 10:34Brad KingNote Added: 0022278
2010-09-20 11:03Mikkel KrautzNote Added: 0022280
2010-09-20 11:09Brad KingNote Added: 0022282
2010-09-20 11:09Brad KingStatusassigned => closed
2010-09-20 11:09Brad KingResolutionopen => fixed
2010-09-23 12:00Bill HoffmanRelationship addedrelated to 0007932
2010-10-06 13:45David ColeFixed in Version => CMake 2.8.3
2010-10-06 13:45David ColeTarget Version => CMake 2.8.3
2011-01-17 16:31David ColeRelationship addedhas duplicate 0011259

Notes
(0022278)
Brad King   
2010-09-20 10:34   
Thanks. I've adapted your patches slightly. Please try this topic:

http://github.com/bradking/CMake/tree/xcode-ARCHS-quoting [^]
http://github.com/bradking/CMake/commit/a8ded5338bf44173fe33e0249ab14aa3d8e7540c [^]
http://github.com/bradking/CMake/commit/0790af3bf54f8b1fcd418fec4ff968ffa55f334c [^]
(0022280)
Mikkel Krautz   
2010-09-20 11:03   
Hi Brad,

Just tried the branch. Works great!
(0022282)
Brad King   
2010-09-20 11:09   
Thanks for testing. I've merged to 'next':

http://cmake.org/gitweb?p=cmake.git;a=log;h=3b8d74b9 [^]

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a8ded533 [^]
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0790af3b [^]