qtbase/bin/qt-cmake-create.in
Luca Di Sera 3388de698b Do not assume FHS in scripts
On systems that do not follow the Filesystem Hierarchy Standard, such as
guix, the hardcoded `/bin/pwd` will fail to be found so that the script
will fail.

Use `pwd`, instead, so that the command can be found through the normal
path search mechanism.

Change-Id: Ib5480aeda5ca9d241286be6d1f95e9a0810476a8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-06-25 11:44:00 +02:00

30 lines
801 B
Bash
Executable File

#!/bin/sh
HELP_MESSAGE="Usage
qt-cmake-create <path/to/project>"
# 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"; 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
if [ "$#" -gt 1 ]; then
echo "Invalid number of arguments"
echo "$HELP_MESSAGE"
exit 1
fi
if [ "$#" -gt 0 ]; then
PROJECT_DIR=$1
else
PROJECT_DIR=$PWD
fi
exec "$cmake_path" -DPROJECT_DIR="$PROJECT_DIR" -P \
"$script_dir_path/@__GlobalConfig_relative_path_from_bin_dir_to_cmake_config_dir@/QtInitProject.cmake"