[Cmake] FILE WRITE and TRY_COMPILE

Amitha Perera perera at cs.rpi.edu
Thu, 6 May 2004 11:15:26 -0400


It seems that the CVS version of CMake doesn't like the output of
FILE WRITE being used as the source for TRY_COMPILE. The
documentation of FILE WRITE suggests that this may cause infinite
loops. The CVS CMake now issues an error when it detects this,
causing an error in the VXL build. I've fixed this by replacing the
FILE WRITE with an equivalent CONFIGURE IMMEDIATE file.

However, I notice that some CMake modules, like
CheckSymbolExists.cmake still use FILE WRITE to generate a temporary
file to feed into a TRY_COMPILE. Presumably, using this will not
trigger the error message. A similar "one-line write" in VXL does not
trigger an error message.

Under what conditions can the output of a FILE WRITE be used as input
for a TRY_COMPILE?

Thanks,
Amitha.