[vlc-commits] tools: fix cmake not finding packages on msys2

Steve Lhomme git at videolan.org
Wed Oct 3 15:09:25 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Oct  1 16:54:51 2018 +0200| [68fd1eaae9dc8fee485882f186a8b15b42e3a42d] | committer: Steve Lhomme

tools: fix cmake not finding packages on msys2

The PKG_CONFIG_PATH is converted to a Windows-like path and thus pkg-config
can't use it.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=68fd1eaae9dc8fee485882f186a8b15b42e3a42d
---

 extras/tools/cmake-msys-FindPkg.patch | 23 +++++++++++++++++++++++
 extras/tools/tools.mak                |  1 +
 2 files changed, 24 insertions(+)

diff --git a/extras/tools/cmake-msys-FindPkg.patch b/extras/tools/cmake-msys-FindPkg.patch
new file mode 100644
index 0000000000..6b73e9eace
--- /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 240fc6eb80..97849e21fc 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)
 



More information about the vlc-commits mailing list