[CMake] Suggestion for CMake platform/compiler detection

Bill Hoffman bill.hoffman at kitware.com
Thu Nov 16 16:40:16 EST 2006


Brandon J. Van Every wrote:
> Bill Hoffman wrote:
>> The problem with the shell, is that you can run cmake, then run make 
>> from a different shell....
>> For the most part that works on unix.   zsh, bash, sh, csh basically 
>> work the same.   The trouble shows up
>> on windows.   
>
> Yep, open source on Windows is nothing but TROUBLE.  It doesn't get 
> the testing, consistency, or packaging of the Linux universe.  Really 
> only the Cygwin stuff is reliable for prime time, and with that you 
> get shafted with the GPL, typically.  -mno_cygwin is possible in 
> theory, but breaks builds in practice, and is never the default for 
> the huge stacks of Cygwin libraries people use.  The point of 
> packaging is to spare people the pain of building things that don't 
> quite build right, so that stuff actually works.  It also turns off a 
> lot of the Unix compatibility, so a lot of things simply won't build.  
> The bottom line is, if you want to do open source and don't want to 
> get stuck with the GPL, you have to build lotsa things from scratch 
> and they tend to break.
>
>> MSYS uses a version of bash, and MinGW uses the windows shell, and 
>> cygwin uses bash,
>> zsh, or some other more like unix. 
>
> Pedantically: MinGW doesn't "use" a shell.  MinGW is a compiler that 
> could be run under straight Windows command prompt, under MSYS, or 
> some perverts even run it under the Cygwin bash shell.  Also a few 
> weirdos like myself, who find MSYS's Autoconf support to be completely 
> broken, use a nonstandard bash shell for MSYS instead of the default 
> rxvt.  http://sourceforge.net/projects/mingw-install really saved my 
> bacon on some legacy Autoconf build issues I was having.
>
> So, I think shell identification is quite valuable.
OK, you seemed to miss my point.   When you run cmake, you can detect 
the shell used at cmake time.  However,
there is no promise that that same shell will be used at make time.  
That is the reason I had to create so many different named
generators, so that the user can tell me which shell they are going to 
use.   But if you need that information you can look at the
generator used.  


-Bill



More information about the CMake mailing list