Files
qt5/init-repository
Fabian Kosmale 61dc233044 init-repository: Check for cmake
And bail out with proper warning if cmake is missing

Change-Id: I39a9e340f873f8de05264d57b2a80fb754b30fbe
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-26 23:07:40 +01:00

31 lines
971 B
Bash
Executable File

#!/bin/sh
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
set -eu
script_dir_path=`dirname $0`
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
optfile=init-repository.opt
opttmpfile=init-repository.opt.in
# check whether cmake exists
if ! [ -x "$(command -v cmake)" ]; then
echo "Error: cmake was not found. You need to install it before configuring Qt."
exit 1
fi
# Posix compatible way to truncate file
: > "$optfile"
: > "$opttmpfile"
# For consistency, use QtWriteArgsFile.cmake to write the optfile like we do on Windows.
# We do the same with the configure script in qtbase.
for arg in "$@"; do echo \"$arg\" >> "$opttmpfile"; done
cmake -DIN_FILE="${opttmpfile}" -DOUT_FILE="${optfile}" -P "${script_dir_path}/cmake/QtWriteArgsFile.cmake"
cmake_script_path="$script_dir_path/cmake/QtIRScript.cmake"
exec cmake -DOPTFILE="${optfile}" -P "$cmake_script_path"