Skip to content

FindPkgConfig: format of PKG_CONFIG_PATH on msys2 and cygwin

In !2979 (closed) some explicit path conversion is proposed. I'd like to discuss the underlying use case and problematic behavior in an issue first, so I'm opening this for it.

From discussion in the MR:

When CMake reads PKG_CONFIG_PATH as an msys2/cygwin path it transforms it into a path that it can understand. I think in the # Prepare and set the environment variable section above this patch. But then using pkg-config with that path will fail because it's not what it expects. Using cygpath -up ensures that the PKG_CONFIG_PATH is both understood by CMake (Windows style but with forward slash) and with pkg-config (no backslash).

...

I think all environment pathes are converted to Windows pathes when run on Windows. This may or not be a general issue of cmake in msys2 but the pkg-config issue is the only one I got so far.

Before my patch the PKG_CONFIG_PATH is C:/Users/robux/Documents/Videolabs/work/contrib/x86_64-w64-mingw32/lib/pkgconfig and after it becomes /c/Users/robux/Documents/Videolabs/work/contrib/x86_64-w64-mingw32/lib/pkgconfig which is usable by pkg-config in msys2.

Cc: @robUx41

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information