[Cmake] FILE WRITE and TRY_COMPILE

William A. Hoffman billlist at nycap.rr.com
Thu, 06 May 2004 11:35:59 -0400


To clarify further, the problem that FILE_WRITE is talking about
only happens when you do something like this:

FILE_WRITE(foo.cmake)
INCLUDE(foo.cmake)

CMake puts dependances between all of the sources and the makefiles.
If a source to cmake is newer than a generated makefile, then cmake
is re-run.   So, using FILE_WRITE to create an input to cmake will
cause some makes to go into an infinite loop of FILE_WRITE/re-run cmake
because the source to the makefile is newer than the makefile.

TRY_COMPILE creates a completely separate cmake environment.   I suppose
if you put the FILE_WRITE into a CMakeList file in a trycompile directory
you would get the error and would have a problem.  Is that the case in VXL?


-Bill


At 11:25 AM 5/6/2004, Andy Cedilnik wrote:
>Hi Amitha,
>
>Could you write example for where it fails?
>
>Try_COMPILE creates internal CMake which uses internal tracking of
>infinite loops. It should ignore the outer ones. 
>
>That said, there may be bug with the code.
>
>                        Andy
>
>On Thu, 2004-05-06 at 11:15, Amitha Perera wrote:
>> 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?
>
>
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake