[cmake-developers] Mingw/msys modifications to Cmake modules

Greg Jung gvjung at gmail.com
Wed May 28 09:19:43 EDT 2014


 I've made some basic changes for the "MSYS Makefiles" generated cmake
run, host is Windows-7 mingw+msys installation(s) -32 bit.  The principal
change was to find the msys versions of /usr, etc.  Most action occurs
before
Compilers are found.  Previously the msys-specific module
CMakeMSYSFindMake.cmake consisted of:

find_program(CMAKE_MAKE_PROGRAM make
  PATHS

 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1;Inno
Setup: App Path]/bin"

 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
   c:/msys/1.0/bin /msys/1.0/bin)
 mark_as_advanced(CMAKE_MAKE_PROGRAM)

Which is wrong/superflous for many reasons.  FindMake works because make is
in $PATH.  Msys users would like
to use the soft mounted paths.  They do not translate into CMake properly
so the current installation configuration
is used to create a useful CMAKE_SYSTEM_[PREFIX | INCLUDE | LIBRARY]_PATH
set of variables useful downstream.
find_program(CMAKE_MAKE_PROGRAM make)
    mark_as_advanced(CMAKE_MAKE_PROGRAM)
#
find_path( _USR_PATH
   msys-1.0.dll
   ENV PATH
   NO_DEFAULT_PATH)
find_path( CMAKE_USR_PATH msys.bat
   PATH ${_USR_PATH}/../
   NO_DEFAULT_PATH)


if(CMAKE_USR_PATH)
#  we seem to have a fully-qualified MSYS host system.
#  not just the stuff we can ram through

   set(CMAKE_SYSTEM_PREFIX_PATH ${CMAKE_USR_PATH}/local;${CMAKE_USR_PATH} )

One added tweak in DetermineSystem is to inspect the $ENV{LDFLAGS} for more
system libraries,
the first item can be a unix-syle path but after that a fully-qualified
windows path is needed;
i.e. export LDFLAGS="-L/mingw/mingw32 -LD:/mingw/local" (/mingw/lib is
already added if mingw/msys is the msys root).

Platform/Windows.cmake and WindowsPath.cmake also get modifications
accomodating a Platform/Mingw.cmake
and also to remove the setting of CMAKE_SYSTEM_PREFIX_PATH replace it by
CMAKE_SYSTEM_PROGRAM_PATH for searching into ${PROGRAMFILES}.  FindMPI
seems to be the only module dependent on this, so I edited
that module to use PROGRAM.  I haven't yet tested a Windows/Mingw build.

I've tested the changes on one build sofar, cmake, it gives identical
compile results as the default module set;
both builds stop for me in the  make at about 12%.  At this stage I'm
adapting it for Linux/Unix (wasn't broken there
bt a lot of junk is tossed into the system paths) and when that is 95% I'll
try and adapt cygwin-64, cygwin32.

I dont know how to operate a git hub but will create one when I do,
 Meanwhile the two things I think I'm done with, for the msys generator
anyway, are attached awaiting comments.

Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140528/2cd8c19e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeDetermineSystem.cmake
Type: application/octet-stream
Size: 10338 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140528/2cd8c19e/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CMakeMSYSFindMake.cmake
Type: application/octet-stream
Size: 1983 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140528/2cd8c19e/attachment-0003.obj>


More information about the cmake-developers mailing list