[cmake-developers] [CMake] Toolchains and CMAKE_FORCE_C_COMPILER in 3.5

James Crosby James.Crosby at arm.com
Wed Feb 17 13:46:55 EST 2016


> On 17 Feb 2016, at 14:33, Brad King <brad.king at kitware.com> wrote:
>
> One could look at adding hooks to the compiler id logic to add alternatives
> provided by the toolchain file.  Or, we could provide a way to set the compiler
> id but not also skip other checks.  In the worst case such a company could modify
> their CMake for use with such a toolchain.  I do not consider this a blocking
> issue for deprecating CMakeForceCompiler.

I think allowing the compiler id to be set might be enough – in the case that
the compiler is completely unknown, functionality is anyway going to be limited
to what the user implements/supports themselves.


> It is not just a check that linking works.  CMake actually encodes string
> literals in the compiled binary and parses it to extract them.  This allows
> us to extract information about the compiler target architecture and compiler
> capabilities.  OTOH we may not actually have to link to achieve this.
>
> Perhaps we could have a setting in a toolchain file like
>
>    set(CMAKE_TRY_COMPILE_NO_LINK 1)
>
> that tells CMake to use add_library(STATIC) instead of add_executable()
> in its generated try_compile projects.  That would avoid linking through
> the toolchain.

OK this makes a lot more sense to me now (I should have looked at the code
first ;). It seems like the option to link a static library would have all the
benefits of getting information out of the compiler itself (instead of
duplicating it in toolchain files), without having to be able to produce a
linkable executable.


> Meanwhile I've de-deprecated the module for the 3.5 release:

Thanks, this will be useful breathing space!


James

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.



More information about the cmake-developers mailing list