ruslo/polly

Conditional cmake configuration based on toolchain

Closed this issue · 4 comments

What is best practice to configure cmake conditionally based on toolchain, it looks like 'POLLY_TOOLCHAIN_TAG' might be the way to go?

e.g. I only want to set target property 'XCODE_ATTRIBUTE_ENABLE_BITCODE YES' when using any of the iOS toolchains.

ruslo commented

it looks like 'POLLY_TOOLCHAIN_TAG' might be the way to go

*_TAG it's atavism, used nowhere now in fact.

e.g. I only want to set target property 'XCODE_ATTRIBUTE_ENABLE_BITCODE YES' when using any of the iOS toolchains

All iOS toolchains set variable IOS so you can check if(IOS). Also as far as I know XCODE_ATTRIBUTE_ENABLE_BITCODE ignored for non Xcode generators so it's okay to set this property unconditionally.

If I use --toolchain xcode then I get the following error, which suggest bit code is only supported on IOS.

target 'foo' has bitcode enabled (ENABLE_BITCODE = YES), but it is not supported for the 'macosx' platform
ruslo commented

If I use --toolchain xcode then I get the following error

Thanks for sharing this information. It mean that if(IOS) should be used.

Using if(IOS) is works, thanks.