bootstrap: Convert MSYS paths to Windows format (#13001)

We set CMAKE_PREFIX_PATH from the --prefix= option.  The calling shell
might not translate "/c/..." to "c:/..." paths but we need to store
Windows paths in CMake cache variables.  Pass the specified path through
the MSYS shell in a form it will convert to a Windows path using the
MSYS fstab.

Some MSYS bash implementations leave trailing space on the command line
to 'cmd /c echo ...' after quoting the message.  The Windows echo tool
preserves both the quotes and the trailing space.  Use a sed expression
that strips quotes and trailing spaces after the end quote.
This commit is contained in:
Brad King 2012-02-29 14:29:16 -05:00
parent 26519d591e
commit 5cd879c4e7
1 changed files with 14 additions and 4 deletions

View File

@ -127,10 +127,20 @@ fi
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
# Helper function to fix windows paths.
cmake_fix_slashes ()
{
echo "$1" | sed 's/\\/\//g'
}
case "${cmake_system}" in
*MINGW*)
cmake_fix_slashes()
{
cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
}
;;
*)
cmake_fix_slashes()
{
echo "$1" | sed 's/\\/\//g'
}
;;
esac
# Choose the default install prefix.
if ${cmake_system_mingw}; then