[vlc-devel] [PATCH] tools: fix cmake not finding packages on msys2
Steve Lhomme
robux4 at ycbcr.xyz
Mon Oct 1 17:26:55 CEST 2018
The PKG_CONFIG_PATH is converted to a Windows-like path and thus pkg-config
can't use it.
---
extras/tools/cmake-msys-FindPkg.patch | 23 +++++++++++++++++++++++
extras/tools/tools.mak | 1 +
2 files changed, 24 insertions(+)
create mode 100644 extras/tools/cmake-msys-FindPkg.patch
diff --git a/extras/tools/cmake-msys-FindPkg.patch b/extras/tools/cmake-msys-FindPkg.patch
new file mode 100644
index 00000000000..6b73e9eace8
--- /dev/null
+++ b/extras/tools/cmake-msys-FindPkg.patch
@@ -0,0 +1,23 @@
+--- cmake/Modules/FindPkgConfig.cmake.msys_pkg 2018-10-01 16:51:37.332632500 +0200
++++ cmake/Modules/FindPkgConfig.cmake 2018-10-01 16:51:46.815041400 +0200
+@@ -344,6 +344,20 @@ macro(_pkg_check_modules_internal _is_re
+ unset(_lib_dirs)
+ unset(_pkgconfig_path)
+ endif()
++
++ if (CYGWIN OR MSYS)
++ # fix the PKG_CONFIG_PATH transformed into a cmake path with incorrect msys pathes
++ file(TO_CMAKE_PATH "$ENV{PKG_CONFIG_PATH}" _pkgconfig_path_cmake)
++ execute_process(
++ COMMAND sh.exe "-c" "cygpath -up '${_pkgconfig_path_cmake}'"
++ RESULT_VARIABLE _cygpath_retval
++ OUTPUT_VARIABLE _cygpath_outval
++ ERROR_VARIABLE _cygpath_error
++ OUTPUT_STRIP_TRAILING_WHITESPACE
++ ERROR_STRIP_TRAILING_WHITESPACE)
++ set(ENV{PKG_CONFIG_PATH} ${_cygpath_outval})
++ #message(STATUS "new ENV $ENV{PKG_CONFIG_PATH}")
++ endif()
+
+ # iterate through module list and check whether they exist and match the required version
+ foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index 240fc6eb80e..97849e21fce 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -91,6 +91,7 @@ cmake-$(CMAKE_VERSION).tar.gz:
cmake: cmake-$(CMAKE_VERSION).tar.gz
$(UNPACK)
+ $(APPLY) cmake-msys-FindPkg.patch
$(APPLY) cmake-winstore.patch
$(MOVE)
--
2.19.0
More information about the vlc-devel
mailing list