[CMake] CMake2.5 - wrong default install location for mingw

Bill Hoffman bill.hoffman at kitware.com
Sat Oct 20 09:32:33 EDT 2007


Gonzalo Garramuño wrote:
> Andreas Pakulat wrote:
>> But exactly that is not supposed to happen. 
> 
> Why not?  Maybe I was not clear:
> 
> cmake2.5 has a "MSYS Makefile" generator.
> 
> I did -G "MSYS Makefile" and I got an install on $PROGRAMFILES.  That's 
> not correct.
> 
> If I wanted to install in $PROGRAMFILES, there's NMake Makefiles or many 
> of the other Windows specific generators.
> 
> MSYS Makefile should install on /usr/local.  I already showed how you 
> can relatively safely figure out where /usr/local is as a win32 path.
> 
> 

Sorry, but I still don't agree.  I am not going to add code into CMake 
that translates POSIX's paths into windows paths.  CMake is a native 
windows application, if you want to set your install prefix for your 
project to where ever you want, you can still do that in cmake.

Something like:

if(CMAKE_GENERATOR MATCHES "MSYS")
    SET(CMAKE_INSTALL_PREFIX  "/what/ever/you/want")
...

That is fine.  But I am not going to add hackish code into CMake so that 
  it can understand mount points and symlinks,

BTW both cygwin and msys have a ln to create symlinks:

$ ln --help
Usage: ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
   or:  ln [OPTION]... TARGET                  (2nd form)
   or:  ln [OPTION]... TARGET... DIRECTORY     (3rd form)
   or:  ln [OPTION]... -t DIRECTORY TARGET...  (4th form)
In the 1st form, create a link to TARGET with the name LINK_NAME.
In the 2nd form, create a link to TARGET in the current directory.
In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.
Create hard links by default, symbolic links with --symbolic.
When creating hard links, each TARGET must exist.


Basically, you want a POSIXs path aware CMake, and to do that right you 
should link cmake to the msys run time library so that all the file 
operations like fopen and such know about mount points, symlinks and 
posix path stuff.   I don't think a hack or table look up will work, you 
  would have to make cmake completely aware of all the extra non windows 
path stuff that is in the msys run time.   Because if the cmake 
installer went to write to /usr/local it would have to know what that 
was.  You would have to change the many many locations where cmake opens 
a file and do the translation hack.

The only way I can see doing this is to link cmake to the msys run time 
library.   As described here:

 > However, the key here is that this MSYS environment is
 >  just a driver for native Win32 tools such as the
 >MinGW gcc which produces MinGW binaries. It is very rare
 > and uncommon to actually use MSYS to build MSYS apps, and
 >in fact to do this you have to install a special environment
 > and use a specially modified copy of gcc -- currently a
 > very old 2.95 version.

CMake would have to be a MSYS app to understand MSYS paths.

But hey CMake is open source, you can always add the code you want by 
yourself.

-Bill





More information about the CMake mailing list