How to get CMake find_file to accept UNIX-style paths on MSYS2?

2015-12-26T02:24:19

I'm using CMake 3.4.1, on Windows 10, with MSYS2 (everything up-to-date as of Dec. 25 2015).

When I use CMake's find_file command, it won't work unless the path is in Windows-style. This is a problem for me, because I'm trying to use findwxWidgets.cmake, which fails because of this.

For example:

CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
find_file(version_h version.h PATHS /mingw64/include/wx-3.0/wx)
message(STATUS "version_h: ${version_h}")

Running cmake spits out:

-- version_h: version_h-NOTFOUND

But it's clearly in there:

>>> file /mingw64/include/wx-3.0/wx/version.h
/mingw64/include/wx-3.0/wx/version.h: C source, ASCII text

I'm wondering if this is a bug, or if there's some obscure flag I have to set to get this to work. How do I get CMake's find_file to find files with UNIX-style paths?

Copyright License:
Author:「midrare」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/34465297/how-to-get-cmake-find-file-to-accept-unix-style-paths-on-msys2

About “How to get CMake find_file to accept UNIX-style paths on MSYS2?” questions

I'm using CMake 3.4.1, on Windows 10, with MSYS2 (everything up-to-date as of Dec. 25 2015). When I use CMake's find_file command, it won't work unless the path is in Windows-style. This is a prob...
I'm trying to use the arduino-cmake framework but my Arduino-SDK is not recognized correctly. Searching for the cause I found the following: find_file(${PLATFORM}_BOARDS_PATH N...
I'm using external cmake with msys2, since cmake-gui provided by msys2 won't run (invalid win32 application). Now the problem is there's only so much I can configure using cmake-gui. I downloaded
I have a project I can build on both Linux and Windows using CMake. The only issue is that Unix-style paths, in CMakeLists.txt, can't work on Windows (which uses backslashes instead of slashes, also
So I have a library here /path/to/CMSIS/libarm_cortexM4lf_math.a I can't seem to find it using find_library with Cmake. Further more I can't find a simple text file with find_file or find_path. I've
I want to detect if the CMakeLists.txt is being summoned inside an MSYS2 environment/shell: $ uname MSYS_NT-10.0-18363 from here I have tried: cmake_minimum_required(VERSION 3.10) project(test_...
So I'm new to MSYS2. I have installed it and also installed MinGW x64 toolchain. As I understand MSYS2 shells don't use all information from system PATH variable, only needed subset. Hence, it does...
I am trying to convert an MSYS2 build from azure pipeline CI (which works) to github actions. I am now stuck with cmake not being recognised as a command. My current (simplified) yaml is the follo...
I'm running cmake in msys2, but it doesn't seem to find Visual Studio 2015 (missing generator option). I am launching the msys2 prompt from within Visual Studio Developer Command Prompt, so I have ...
Opening the mingw64 shell (from msys2) and typing cmake-gui I get the following error: `$ cmake-gui C:/DEV/msys64/mingw64/bin/cmake-gui.exe: error while loading shared libraries:` Qt5WinExtra...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.