[CMake] Toolchains and CMAKE_FORCE_C_COMPILER in 3.5

Vania Joloboff vania.joloboff at inria.fr
Wed Feb 10 03:49:35 EST 2016


Hi

We have not yet moved to 3.5 but seeing this discussion, I am wondering
what we will have to do. In our project, we have several C and C++ cross 
compilers and we want to compare them on selected benchmarks. We also 
want to compare different compile options and different linking options. 
We know for sure these cross compilers are working properly
and our technique today is roughly

CMakeForceCompiler(A)
compile benchmarks with A (and various options)
CMakeForceCCompiler(B)
compile benchmarks with B
CMakeForceCompiler(C)
compile benchmarks with C

Next, we run all the benchmarks and compare the results.

How am I supposed to do that if CMakeForceCompiler() is deprecated ?

Vania



On 02/09/2016 06:02 PM, Brad King wrote:
> 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