[vlc-devel] [PATCH 3.0 3/6] tools: don't use sh.exe to call cygpath.exe in cmake

Steve Lhomme robux4 at ycbcr.xyz
Wed Jun 17 12:57:22 CEST 2020


Just look for the .exe in the path and run it. It will find its root from its
path.

(cherry picked from commit e62999a6b1ccdf6b03204f486ec348eec7931922)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 extras/tools/cmake-msys-FindPkg.patch | 38 +++++++++++++++------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/extras/tools/cmake-msys-FindPkg.patch b/extras/tools/cmake-msys-FindPkg.patch
index 6b73e9eace..2448259dcc 100644
--- a/extras/tools/cmake-msys-FindPkg.patch
+++ b/extras/tools/cmake-msys-FindPkg.patch
@@ -1,23 +1,27 @@
---- 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)
+--- ./Modules/FindPkgConfig.cmake.msys	2017-05-31 16:00:09.000000000 +0200
++++ ./Modules/FindPkgConfig.cmake	2018-10-03 16:43:37.880991800 +0200
+@@ -345,6 +345,24 @@ macro(_pkg_check_modules_internal _is_re
        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}")
++        find_program(_cygpath_exe cygpath.exe NO_CMAKE_ENVIRONMENT_PATH)
++        if(_cygpath_exe)
++            # 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 ${_cygpath_exe} "-up" "${_pkgconfig_path_cmake}"
++                RESULT_VARIABLE _cygpath_retval
++                OUTPUT_VARIABLE _cygpath_outval
++                ERROR_VARIABLE _cygpath_error
++                OUTPUT_STRIP_TRAILING_WHITESPACE
++                ERROR_STRIP_TRAILING_WHITESPACE)
++            if (_cygpath_outval)
++                set(ENV{PKG_CONFIG_PATH} ${_cygpath_outval})
++            endif()
++        endif()
 +    endif()
- 
++
      # iterate through module list and check whether they exist and match the required version
      foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
+       set(_pkg_check_modules_exist_query)
-- 
2.26.2



More information about the vlc-devel mailing list