[CMake] CMake 2.8.6 --> 2.8.8 New TryCompile Fails on GCC-GNAT Ada Linking

Brad King brad.king at kitware.com
Mon Jul 9 08:41:24 EDT 2012


On 07/06/2012 07:46 AM, Matthew Schuchard wrote:
> I thought the change had been to preserve prior TryCompiles for 
> debugging purposes.
> Would it be too cynical to propose some OS #ifdefs above the code?
> Although you mention file systems, so this an NTFS issue also?

We don't know what causes it.  Some virus scanners will hold a handle
on executable files while scanning them immediately after creation so
there is a race for deletion before the next try-compile runs.  There
have been other more mysterious problems too, all having something to
do with rapid creation and deletion of .exe files.

> Of course, at the end of the day this is what breaks GNAT TryCompile:
> 
> - targetName = "cmTryCompileExec";
> 
> But not removing that line of code would seemingly break everything else.
> 
> So the path of least resistance cynical code change proposal:
> 
> #ifdef __linux__
> targetNameBuf = "cmTryCompileExec";
> #else
> sprintf(targetNameBuf, "cmTryCompileExec%u",
>             cmSystemTools::RandomSeed());
> #endif
> 
> With a nice comment like "so this annoying coding language Ada and its 
> terribly conceived compiler GNAT can be supported on Linux" or some such.

I'd rather it be something like

 if(this->Makefile->IsOn("CMAKE_"+lang+"_TRY_COMPILE_NO_RANDOM"))

so your platform files can control it.

-Brad


More information about the CMake mailing list