[CMake] CMake --debug-trycompile option breaking tests

Bill Hoffman bill.hoffman at kitware.com
Tue Aug 30 15:38:20 EDT 2011


On 8/30/2011 3:09 PM, Clifford Yapp wrote:
> We're seeing a problem when trying to run a cmake configuration using
> both the TestBigEndian.cmake macro and the --debug-trycompile command
> line option for CMake:
>
> Sometimes we're getting
>
> CMake Error at TestBigEndian.cmake:44 (MESSAGE):
>    no suitable type found
>
> Oddly, if I copy the CheckTypeSize macro to our local CMake directory
> in the build, we then progress further to:
>
> CMake Error at TestBigEndian.cmake:97 (MESSAGE):
>    TEST_BIG_ENDIAN found no result!
>
>
> I'm seeing a few other indications that whatever --debug-trycompile is
> doing, it is messing with the results of various tests - has anybody
> else seen this problem?  It would be very handy for us to be able to
> preserve the sources from functionality testing to make sure they're
> doing what we think they're doing, but so far it looks like trying to
> save them with --debug-trycompile is breaking things.
>

The --debug-trycompile option tells CMake to leave all the results from 
trycompile runs in its temporary directory.  So, it can and often does 
change the result that CMake might get.   It is meant to be used as a 
way of seeing exactly what files are being written by CMake, and trying 
the build by hand.   I usually use it like this:

1. run cmake on the whole project.
2. remove the cache entry for the try-compile that I have and issue for
3. run cmake --debug-trycompile

cd CMakeFiles/CMakeTmp
run make or some ide on the files.

Since CMake reuses the same directory over and over, we have to clear it 
out each time, or the stuff from the previous try-compile might affect 
the next one.

-Bill



More information about the CMake mailing list