filipwasil / ios-cmake

Automatically exported from code.google.com/p/ios-cmake
0 stars 0 forks source link

check_c_source_compiles test always fails #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have a library that uses a lot of check_c_source_compiles, 
check_function_exists, check_symbol_exists, etc. checks.
These checks are based on try_compile function which just tries to compile an 
executable from a single source file.

When ios toolchain is active compiler is unable to make "ordinary" executables:

> Check dependencies
> target specifies product type 'com.apple.product-type.tool', but there's no 
such product type for the 'iphoneos' platform

Original issue reported on code.google.com by Equidamoid on 17 Nov 2013 at 8:30

GoogleCodeExporter commented 9 years ago
We never had the iOS-cmake toolchain capable of creating executables. When we 
first looked into it there was a lot of overriding to be done with cmake+xcode 
hacks to even try to make it work. Plus the resulting executable couldn't be 
run in iOS-device builds on the mac so it wasn't that useful to pursue. 

CMake has evolved quite a bit since then; perhaps we could attempt to add that 
functionality. 

Original comment by wizzr...@gmail.com on 18 Nov 2013 at 3:40

GoogleCodeExporter commented 9 years ago

The only use of that functions is to check that, for example, "#include 
<pthread.h>" is not causing compile errors and pthread library is available. 
The executable itself is not interesting at all.
Maybe it is possible to make a hook somewhere so cmake will try to build a 
(static) library instead of executable? I hope this will fix at least includes 
and compiler features tests.

Original comment by Equidamoid on 18 Nov 2013 at 8:02

GoogleCodeExporter commented 9 years ago
I use this patch against cmake 3.0.0.
I can successfully use try_compile.
You will have to set extra env in your toolchain :

set (MACOSX_BUNDLE_GUI_IDENTIFIER "com.yourcompany.app")
set (XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")

Original comment by hsiv...@gmail.com on 27 Jul 2014 at 3:08

Attachments: