[CMake] Separating SET_TARGET_PROPERTIES() for different configurations

Daniel Dekkers d.dekkers at cthrough.nl
Thu Oct 13 10:02:20 EDT 2011


Hi, 

Comparing Xcode generator output to standard Xcode output...

If I look at a different project file (non CMake) which shows correct behavior, a part of the project.pbxproj looks like:

...
/* Begin XCBuildConfiguration section */
	1D6058940D05DD3E006BFB54 /* Debug */ = {
		isa = XCBuildConfiguration;
		buildSettings = {
			ALWAYS_SEARCH_USER_PATHS = YES;
			ARCHS = "$(ARCHS_STANDARD_32_BIT)";
			CODE_SIGN_ENTITLEMENTS = ./EntitlementsDebug.plist;
			"CODE_SIGN_ENTITLEMENTS[sdk=*]" = ./EntitlementsDebug.plist; 
...

While in this case for this new CMake project it looks like:

...
346308F43B804647BD39C65F /* RelWithDebInfo */ = {
	isa = XCBuildConfiguration;
	buildSettings = {
		ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
		"CODE_SIGN_ENTITLEMENTS[variant=Debug]" = /Users/danieldekkers/development/RenderTools/examples/SettingsTest/rsrc/apple/ios/entitlements/EntitlementsDebug.plist;
...

So the first doesn't seem to need a [variant=<configuration>] (internally) since it is already in the section "Debug". But it does use [sdk=*]. To avoid further subdivision of the Debug setting into different SDKs?

On Oct 13, 2011, at 3:23 PM, Daniel Dekkers wrote:

> Thanks Michael,
> 
> Just found it out myself as well (and yes, XCODE_ATTRIBUTE was the google entry).
> 
> SET_TARGET_PROPERTIES( ${RT_APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS[variant=Debug] ${RT_IOS_CODE_SIGN_ENTITLEMENTS_DEBUG} )
> SET_TARGET_PROPERTIES( ${RT_APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS[variant=Release] ${RT_IOS_CODE_SIGN_ENTITLEMENTS_ADHOC} )
> SET_TARGET_PROPERTIES( ${RT_APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS[variant=RelWithDebInfo] ${RT_IOS_CODE_SIGN_ENTITLEMENTS_DISTRIBUTION} )
> SET_TARGET_PROPERTIES( ${RT_APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS[variant=MinSizeRel] ${RT_IOS_CODE_SIGN_ENTITLEMENTS_DISTRIBUTION} )
> 
> But now I get four "Any SDK" entries inside each of the four different configurations (16 in total), the list of "Any SDK"'s containing the different entitlement entries.
> 
> So...
> 
> Code Signing Entitlements
>  Debug
>    Any SDK   path/to/.../EntitlementsAdHoc.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>    Any SDK   path/to/.../EntitlementsDebug.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>  MinSizeRel
>    Any SDK   path/to/.../EntitlementsAdHoc.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>    Any SDK   path/to/.../EntitlementsDebug.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>  RelWithDebInfo
>    Any SDK   path/to/.../EntitlementsAdHoc.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>    Any SDK   path/to/.../EntitlementsDebug.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>  Release
>    Any SDK   path/to/.../EntitlementsAdHoc.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
>    Any SDK   path/to/.../EntitlementsDebug.plist
>    Any SDK   path/to/.../EntitlementsDistribution.plist
> 
> ...while I was hoping for...
> 
> Code Signing Entitlements
>  Debug path/to/.../EntitlementsDebug.plist
>  MinSizeRel path/to/.../EntitlementsDistribution.plist
>  RelWithDebInfo path/to/.../EntitlementsDistribution.plist
>  Release path/to/.../EntitlementsAdHoc.plist
> 
> Anyone knows what happening here?
> 
> Daniel
> 
> On Oct 13, 2011, at 2:52 PM, Michael Wild wrote:
> 
>> On 10/13/2011 02:26 PM, Daniel Dekkers wrote:
>>> Hi,
>>> 
>>> How can I separate settings for different configurations in Xcode.
>>> 
>>> As an example...
>>> 
>>> 		SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${IOS_CODE_SIGN_ENTITLEMENTS} )
>>> 
>>> ... sets the same entitlement file for all four configurations (Debug, Release, MinSizeRel, RelWithDebInfo) to ${IOS_CODE_SIGN_ENTITLEMENTS}. 
>>> 
>>> But now i would like to use different different files for different configurations, something like this:
>>> 
>>> 		SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES LINK_FLAG_DEBUG XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${IOS_CODE_SIGN_ENTITLEMENTS_DEBUG} )
>>> 		SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES LINK_FLAG_RELEASE XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${IOS_CODE_SIGN_ENTITLEMENTS_ADHOC} )
>>> 		SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES LINK_FLAG_MINSIZEREL XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${IOS_CODE_SIGN_ENTITLEMENTS_DISTRIBUTION} )
>>> 		SET_TARGET_PROPERTIES( ${APP_NAME} PROPERTIES LINK_FLAG_RELWITHDEBINFO XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${IOS_CODE_SIGN_ENTITLEMENTS_DEBUG} )
>>> 
>>> But this syntax is not recognized.
>>> 
>>> Kind Regards, 
>>> 
>>> Daniel Dekkers
>> 
>> 
>> You can use XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS[variant=Debug] etc.
>> See
>> http://stackoverflow.com/questions/1354542/how-to-set-an-xcode-attribute-in-cmake-for-a-specific-configuration.
>> Wonder why this didn't make it into the documentation. But then,
>> googling XCODE_ATTRIBUTE returned this find pretty high up in the search
>> results...
>> 
>> Michael
> 
> --
> 
> 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



More information about the CMake mailing list