[CMake] XCode4 and archiving

NoRulez norulez at me.com
Thu Jul 7 04:43:21 EDT 2011


I already tried to set the flag to YES/NO in XCode, but an archive is not created.
Did you do something else too?

Am 07.07.2011 um 10:30 schrieb Johan Knutzen <johan at knutzen.se>:

> I should add that this is not solved simply by the script. By default CMake sets the SKIP_INSTALL flag on all targets to NO. This prevents an archive build to be made if your executable is linking with static libraries. To solve this I had to do this on a top level:
> set(CMAKE_XCODE_ATTRIBUTE_SKIP_INSTALL "YES")
> 
> This will set the flag to YES on all targets in the project. However, in order to override this on my executable I set this:
> set_property(TARGET game PROPERTY XCODE_ATTRIBUTE_SKIP_INSTALL "NO")
> 
> Here [game] is the name of my target which is the executable.
> 
> I must confess that I do not understand why the SKIP_INSTALL flag affects an archive build, but that's just the way it is. There are a number of build setting fields that cmake sets to empty strings by default that in my opinion should not exist. 
> 
> In general whenever I have problems with this sort of thing, I just change the settings in XCode, open the pbxproj file and check what changes are necessary in CMake. 
> 
> Johan
> 
> 
> On Thu, Jul 7, 2011 at 9:43 AM, NoRulez <norulez at me.com> wrote:
> Hi,
> 
> I want to ask if this would be fixed in 2.8.5?
> 
> Thanks in advance
> 
> Best Regards
> NoRulez
> 
> Am 27.06.2011 um 12:35 schrieb David Cole <david.cole at kitware.com>:
> 
>> 
>> 
>> On Mon, Jun 27, 2011 at 4:35 AM, Johan Knutzen <knutzen_johan at yahoo.se> wrote:
>> Hey!
>> 
>> Thank you for your reply. I tried unsetting CMAKE_XCODE_ATTRIBUTE_INSTALL_PATH
>> but since it is not defined until the generator actually runs it does nothing. An interesting not is that if I do:
>> set(CMAKE_XCODE_ATTRIBUTE_INSTALL_PATH "test")
>> all INSTALL_PATH entries in xcode become test, so there should a a connection. The problem lies in that INSTALL_PATH gets set by default to "", but a project file generated by XCode does not set it at all.
>> 
>> Another bug in the generating step is that this line in cmake:
>> set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
>> generates
>> TARGETED_DEVICE_FAMILY = 1,2;
>> instead of what's correct:
>> TARGETED_DEVICE_FAMILY = "1,2";
>> 
>> However, this line:
>> set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1")
>> generates:
>> TARGETED_DEVICE_FAMILY = "1";
>> which is correct. Notice the encompassing "".
>> 
>> So in order to get the encompassing "" one might try:
>> set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1, 2")
>> which generates:
>> TARGETED_DEVICE_FAMILY = "1, 2";
>> 
>> However "1, 2" with a space after , can not be parsed by Xcode 4. 
>> 
>> A hack which works is:
>> set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2 ")
>> which generates:
>> TARGETED_DEVICE_FAMILY = "1,2 ";
>> 
>> which for some reason can be parsed and is parsed correctly by XCode 4. Note the space after 2. 
>> 
>> Regarding INSTALL_PATH, if someone has any ideas about how this can be fixed using CMake instead of in a script run after the generating step please reply. 
>> 
>> And another question: Where do I find the code which actually creates the entries in targets of an xcode 4 project? Is it all in the binary or are there any other run-time files which I can modify and perhaps submit as a patch? 
>> 
>> 
>> It's in the source code for CMake itself, likely in one or more of these files:
>> 
>> $ find . | grep -i xcode | grep -v /.git/
>> ./Modules/CMakeFindXCode.cmake
>> ./Source/cmGlobalXCodeGenerator.cxx
>> ./Source/cmGlobalXCodeGenerator.h
>> ./Source/cmLocalXCodeGenerator.cxx
>> ./Source/cmLocalXCodeGenerator.h
>> ./Source/cmXCode21Object.cxx
>> ./Source/cmXCode21Object.h
>> ./Source/cmXCodeObject.cxx
>> ./Source/cmXCodeObject.h
>> 
>> 
>>  
>> 
>> Johan
>> 
>> --- Den sön 2011-06-26 skrev David Cole <david.cole at kitware.com>:
>> 
>> Från: David Cole <david.cole at kitware.com>
>> Ämne: Re: [CMake] XCode4 and archiving
>> Till: johan at knutzen.se
>> Kopia: eracce at senri.se, cmake at cmake.org
>> Datum: söndag 26 juni 2011 22:37
>> 
>> 
>> We will be getting to various Xcode 4 issues over the coming months.
>> 
>> In the meantime, I would look into whether there's a way to suppress the generation of the INSTALL_PATH lines rather than having to run a post-processing script. If I remember this later on.... I'll check into it myself and report back.
>> 
>> 
>> HTH,
>> David
>> 
>> 
>> On Sun, Jun 26, 2011 at 12:11 PM, Johan Knutzen <knutzen_johan at yahoo.se> wrote:
>> I found a workaround, if anybody is interested. The problem lies in the cmake generator setting the INSTALL_PATH to "" in the project file. Not sure why cmake does this, but a fix is to remove all entries.
>> 
>> Here is a bash script which takes a pbxproj file as argument and fixes it:
>> #! /bin/bash
>> sed -i".bak" '/INSTALL_PATH/d' $1
>> 
>> Would be helpful if somebody working on cmake would comment, and perhaps fix this issue.
>> 
>> Johan
>> 
>> 
>> --- Den sön 2011-06-26 skrev Johan Knutzen <knutzen_johan at yahoo.se>:
>> 
>> > Från: Johan Knutzen <knutzen_johan at yahoo.se>
>> > Ämne: [CMake] XCode4 and archiving
>> > Till: cmake at cmake.org
>> > Datum: söndag 26 juni 2011 16:00
>> > Hey!
>> >
>> > I've experienced a few hickups when using cmake with XCode
>> > 4, and one of them is the ability to create archives. In the
>> > IDE you do this by clicking Product->Archive, which
>> > results in an archive which you later can sign with
>> > different provisioning profiles when distributing iOS apps
>> > to beta testers.
>> >
>> > However, for projects generated using cmake the archiving
>> > command does not work. The result of that command should be
>> > an archiving listed in the organizer, but that is not the
>> > case when you have a cmake generated project.
>> >
>> > Does anyone have a solution or work around for this?
>> >
>> > Johan
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the CMake FAQ at:
>> > http://www.cmake.org/Wiki/CMake_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.cmake.org/mailman/listinfo/cmake
>> >
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>> 
>> 
>> -----Infogad bilaga följer-----
>> 
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> 
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110707/380adfee/attachment.htm>


More information about the CMake mailing list