[CMake] EXECUTE_PROCESS too good at running programs

Brandon J. Van Every bvanevery at gmail.com
Fri Jul 21 16:21:22 EDT 2006


Brad King wrote:
> Brandon J. Van Every wrote:
>   
>> I explained the situation pretty clearly, I thought. 
>> E:\msys\1.0\bin\makefile does *NOT* run under a Windows command prompt. 
>> It's not supposed to.  As I said before, there's a comment at the top of
>> the binary that says it's not supposed to.  Just to reiterate again in
>> case there's any doubt:
>>
>> E:\msys\1.0\bin>dir makeinfo
>> Volume in drive E is MONDRIAN
>> Volume Serial Number is 9CA0-CADF
>>
>> Directory of E:\msys\1.0\bin
>>
>> 04/30/2004  11:15p             180,224 makeinfo
>>               1 File(s)        180,224 bytes
>>               0 Dir(s)  11,499,749,376 bytes free
>>
>> E:\msys\1.0\bin>cmd
>> Microsoft Windows 2000 [Version 5.00.2195]
>> (C) Copyright 1985-2000 Microsoft Corp.
>>
>> E:\msys\1.0\bin>makeinfo
>> 'makeinfo' is not recognized as an internal or external command,
>> operable program or batch file.
>>     
>
> I don't think your test is reliable.  My MSYS has a makeinfo.exe and it
> runs under a windows shell.
>   

My test is plenty reliable.  I have ***makeinfo***, not makeinfo.exe.  
Please read *ALL* the details of my post.  There are ~30 tools in 
E:\msys\1.0\bin that do not have .exe suffixes, run fine under a MSYS 
shell, and are not intended to be run under anything but a MSYS shell.  
EXECUTE_PROCESS is finding a way to run them.  My wild-assed-guess as to 
explanation, is that it execs arbitrarily named files, and does not 
check whether the filename is valid for a Windows command prompt.  These 
MSYS tools are probably valid apps in some Windows-native sense, but not 
to a Windows command prompt.


> Anyway, if you want to test whether a program is executable under the
> build environment, you should use TRY_COMPILE with a small project with
> a custom command to run the program.
>
>   

That is a (tedious) workaround, but I still say the behavior of 
EXECUTE_PROCESS is bugged.  I don't think anyone should have to write an 
OS-specific C coded exec wrapper just to determine if "makeinfo" 
actually works under the build environment. 


Cheers,
Brandon Van Every

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060721/201ee53b/attachment.htm


More information about the CMake mailing list