[cmake-developers] [PATCH] Retrieve Xcode CompilerId via static libraries

Brad King brad.king at kitware.com
Mon Jan 12 09:00:45 EST 2015


Hi Gregor,

Thanks for working on this.  Unfortunately it is a bit complex.

On 1/11/2015 2:25 PM, Gregor Jasny wrote:
> The current approach to determine the CompilerId via
> an XCTest bundle on iOS requires a valid code sign identity.

All the subsequent try_compile calls, including ABI detection,
currently require a signing identity too.  An approach to
overcome that (CODE_SIGNING_REQUIRED) is mentioned here:

 http://www.cmake.org/Bug/view.php?id=15329

I've made a change using that approach here:

 Xcode: Do not require code signing for compiler id (#15329)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=584aaa1c

That also discusses the need to use a different product type
for try_compile calls too.  For those linking is needed so we
cannot use static libraries.  Selection has to be specific to
the target platform.

> This is a regression compared to CMake 3.0. This patch changes
> the detection to be performed on a static library and also
> unifies detection across iOS and OSX.

As explained in

 http://www.cmake.org/Bug/view.php?id=15214#c37064

3.0 only detected the host OS X compiler.

> -    #  Ld ...
> +    #  CompileC ...

Some versions of Xcode do not actually print the compilation
command line with the full path to the correct compiler tool.
For example with C++ it may compile with the path to the C
compiler and use "-x c++".  That's why we have to use Ld, and
therefore need a product type that links.

I really wish there were another way to detect the path to the
compiler tool that Xcode invokes :(

-Brad


More information about the cmake-developers mailing list