[CMake] MSYS2 broken CMAKE_PREFIX_PATH

Mario Emmenlauer mario at emmenlauer.de
Mon Feb 12 04:15:47 EST 2018


Hi Marc,

On 12.02.2018 09:40, CHEVRIER, Marc wrote:
> Be aware that MSYS2 environment is a "dual" environment:
> * Unix like environment. Executables are in <MSYS2_ROOT>/usr/bin
> * Windows like (i.e. understand windows paths but with slashes rather than back-slashes). Executables are in <MSYS2_ROOT>/ mingw(64|32)/bin.
> 
> So, if you want a pure unix like usage, you have to install package 'msys/cmake'.
> If you use tool in mingw(32|64)/bin (package 'mingw32/mingw-w64-i686-cmake' or ' mingw64/mingw-w64-x86_64-cmake'), use windows paths (ex: C:/DESTDIR/lib/cmake).

This is an interesting thought! I see that many tools from mingw(32|64)/bin
accept both path styles, and about 90% of my build system uses pure Unix
style. This is the first time I encounter a problem. Its at least interesting
that cmake seems slightly inconsistent here: it accepts Unix style for
CMAKE_PREFIX_PATH when using find_xxx(), but no Unix style for detecting
package configuration files.

I see now that the problem is more likely on my side. But on the other hand,
it would be cool if cmake could consistently accept Unix style on MSYS2/MinGW
platforms. Would it be worthwhile to make this a cmake issue?

All the best,

   Mario



> 
> On 12/02/2018 09:32, "CMake on behalf of Mario Emmenlauer" <cmake-bounces at cmake.org on behalf of mario at emmenlauer.de> wrote:
> 
>     
>     Dear Alan,
>     
>     thanks for your reply! Below more:
>     
>     On 11.02.2018 23:11, Alan W. Irwin wrote:
>     > On 2018-02-11 15:13+0100 Mario Emmenlauer wrote:
>     > 
>     >>
>     >> I use mingw-w64-x86_64-cmake 3.10.2 on MSYS2. Generally it works well,
>     >> but just recently I started to have problems with CMAKE_PREFIX_PATH.
>     >> Its possible that the problems have been there forever, but I now just
>     >> found them due to a better use of CI systems.
>     >>
>     >> The problem is that cmake is not finding package configuration files
>     >> correctly. I have such files in DESTDIR/lib/cmake, i.e. for a library
>     >> XXX there are typically files XXXConfig.cmake, XXXConfigVersion.cmake
>     >> and XXXTargets.cmake (i.e. for Qt, VTK and others).
>     >>
>     >> But they are not found when I specify CMAKE_PREFIX_PATH=DESTDIR/lib/cmake
>     >> in Unix path style. It does work when I specify the package configuration
>     >> directory in Windows style! This makes things quite confusing, because many
>     >> find_xxx() commands for headers and libraries work with Unix paths. So now
>     >> I need to use CMAKE_PREFIX_PATH=UNIXDESTDIR for the normal find_xxx(), but
>     >> add WINDESTDIR\lib\cmake for the package configuration files (*).
>     >>
>     >> Is this an MSYS2 issue or a standard cmake issue? I reported it with MSYS2
>     >> here https://github.com/Alexpux/MINGW-packages/issues/3337 in case someone
>     >> can comment?
>     > 
>     > Hi Mario:
>     > 
>     > From <https://github.com/msys2/msys2/wiki/MSYS2-introduction>, and
>     > what you said above it appears you are using the "native Windows"
>     > cmake version from the mingw64 repository rather than the POSIX-style
>     > cmake package you can install from the msys2 repository.  I am pretty
>     
>     Hmm, I don't think I have a native Windows cmake installed. I installed
>     mingw-w64-*-cmake from pacman, and I do not find any other cmake.exe in
>     PATH or on the hard disk. At least when I do:
>     
>     #> find /c/ /d/ -name cmake.exe 2>/dev/zero
>     /d/msys2/bda/mingw32/bin/cmake.exe
>     /d/msys2/bda/mingw64/bin/cmake.exe
>     
>     I find only the native MSYS2 mingw-w64-x86_64-cmake / mingw-w64-xi686-cmake.
>     
>     All the best,
>     
>        Mario
>     
>     
>     
>     > sure the native version would not do well with non-native POSIX-style
>     > paths so I am not surprised by your results.  Anyhow, I suggest you
>     > experiment with native versus POSIX cmake packages in both CMD and
>     > bash (from msys2) environments to establish what the different results
>     > are in those four cases for native Windows and POSIX paths.
>     > 
>     > Note I have no access to MinGW-w64/MSYS2 myself, but I do pay close
>     > attention to this platform because it is the best Windows platform for
>     > PLplot according to a fellow PLplot developer who does have a lot of
>     > practical experience with this platform.
>     > 
>     > Alan
>     > __________________________
>     > Alan W. Irwin
>     > 
>     > Astronomical research affiliation with Department of Physics and Astronomy,
>     > University of Victoria (astrowww.phys.uvic.ca).
>     > 
>     > Programming affiliations with the FreeEOS equation-of-state
>     > implementation for stellar interiors (freeeos.sf.net); the Time
>     > Ephemerides project (timeephem.sf.net); PLplot scientific plotting
>     > software package (plplot.sf.net); the libLASi project
>     > (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
>     > and the Linux Brochure Project (lbproject.sf.net).
>     > __________________________
>     > 
>     > Linux-powered Science
>     > __________________________
>     > 
>     
>     
>     
>     Viele Gruesse,
>     
>         Mario Emmenlauer
>     
>     
>     --
>     BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
>     Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
>     D-81669 München                          http://www.biodataanalysis.de/
>     -- 
>     
>     Powered by www.kitware.com
>     
>     Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>     
>     Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>     
>     CMake Support: http://cmake.org/cmake/help/support.html
>     CMake Consulting: http://cmake.org/cmake/help/consulting.html
>     CMake Training Courses: http://cmake.org/cmake/help/training.html
>     
>     Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>     
>     Follow this link to subscribe/unsubscribe:
>     https://cmake.org/mailman/listinfo/cmake
>     
> 



Viele Gruesse,

    Mario Emmenlauer


--
BioDataAnalysis GmbH, Mario Emmenlauer      Tel. Buero: +49-89-74677203
Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
D-81669 München                          http://www.biodataanalysis.de/


More information about the CMake mailing list