diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/qt-cmake.bat.in | 11 | ||||
-rwxr-xr-x | bin/qt-cmake.in | 16 |
2 files changed, 25 insertions, 2 deletions
diff --git a/bin/qt-cmake.bat.in b/bin/qt-cmake.bat.in index 6e5b27010b..2645c0320f 100644 --- a/bin/qt-cmake.bat.in +++ b/bin/qt-cmake.bat.in @@ -1 +1,10 @@ -"@CMAKE_COMMAND@" -DCMAKE_TOOLCHAIN_FILE="@__GlobalConfig_install_dir_absolute@/qt.toolchain.cmake" @__qt_cmake_extra@ %* +@echo off +:: The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory. +set script_dir_path=%~dp0 + +:: Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH. +set cmake_path=@CMAKE_COMMAND@ +if not exist "%cmake_path%" set cmake_path=cmake + +set toolchain_path=%script_dir_path%/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake +"%cmake_path%" -DCMAKE_TOOLCHAIN_FILE="%toolchain_path%" @__qt_cmake_extra@ %* diff --git a/bin/qt-cmake.in b/bin/qt-cmake.in index 2b42592267..f719257f60 100755 --- a/bin/qt-cmake.in +++ b/bin/qt-cmake.in @@ -1,3 +1,17 @@ #!/bin/sh -exec @CMAKE_COMMAND@ -DCMAKE_TOOLCHAIN_FILE=@__GlobalConfig_install_dir_absolute@/qt.toolchain.cmake @__qt_cmake_extra@ "$@" +# The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory. +script_dir_path=`dirname $0` +script_dir_path=`(cd "$script_dir_path"; /bin/pwd)` + +# Try to use original cmake, otherwise to make it relocatable, use any cmake found in PATH. +original_cmake_path="@CMAKE_COMMAND@" +cmake_path=$original_cmake_path +if ! test -f "$cmake_path"; then + cmake_path="cmake" +fi + +toolchain_path="$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/qt.toolchain.cmake" + +# Find the qt toolchain relative to the absolute bin dir path where the script is located. +exec "$cmake_path" -DCMAKE_TOOLCHAIN_FILE="$toolchain_path" @__qt_cmake_extra@ "$@" |