[CMake] Toolchains and CMAKE_FORCE_C_COMPILER in 3.5

Brad King brad.king at kitware.com
Tue Feb 9 12:02:12 EST 2016


Hi Thibault,

Thanks for trying the release candidate!

On 02/09/2016 09:10 AM, Thibault Genessay wrote:
> I installed 3.5 and the build broke

While CMakeForceCompiler is deprecated we think it should still work
in most cases where it worked before, just with a warning.  What
actually breaks?

> CMake complaining that this macro was deprecated and should
> not be used because of the many improvements on the compiler
> detection side.

For reference, the discussion that led to this decision was here:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14410/focus=14500

Basically CMake now needs to detect a lot more from the compiler than
we can expect a caller to provide in a CMAKE_FORCE_C_COMPILER call.
We need to make the compiler detection work for everyone.

> why I did use this FORCE hack in the first place: CMake tells me
> my compiler is broken because it cannot compile a test program
> (undefined symbol: _exit). This is somehow correct, as I compile
> for bare metal and I am providing the _exit function in my code.

Does CMake at least detect the compiler id and version correctly?
Is it then only the test for working compiler that fails?  Is there
something from the toolchain we can query to decide whether it can
link an executable without an extra spec file?

Thanks,
-Brad



More information about the CMake mailing list