mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Meta: Check for CMake version in ladybird.sh
CMake reads CMakePresets.json, which is before it reads CMakeLists.txt. This causes CMake Error: Unrecognized "version" field if the version of CMake is older than support for presets, or the version field of presets. The fix is to check CMake version in ladybird.sh before trying to create the build directory. Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
This commit is contained in:
parent
1d7c9cd1e1
commit
26415d39f7
Notes:
github-actions[bot]
2024-09-09 19:11:15 +00:00
Author: https://github.com/Laura-Braun 🔰 Commit: https://github.com/LadybirdBrowser/ladybird/commit/26415d39f7b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1110 Reviewed-by: https://github.com/circl-lastname
2 changed files with 19 additions and 0 deletions
|
@ -88,6 +88,7 @@ get_top_dir() {
|
|||
}
|
||||
|
||||
create_build_dir() {
|
||||
check_program_version_at_least CMake cmake 3.25 || exit 1
|
||||
cmake --preset "$BUILD_PRESET" "${CMAKE_ARGS[@]}" -S "$LADYBIRD_SOURCE_DIR" -B "$BUILD_DIR"
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,24 @@ exit_if_running_as_root() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Usage: check_program_version_at_least <Display Name> <Program Name> <Version String>
|
||||
check_program_version_at_least()
|
||||
{
|
||||
echo -n "Checking for $1 version at least $3... "
|
||||
if ! command -v "$2" > /dev/null 2>&1; then
|
||||
echo "ERROR: Cannot find $2 ($1)"
|
||||
return 1
|
||||
fi
|
||||
v=$("$2" --version 2>&1 | grep -E -o '[0-9]+\.[0-9\.]+[a-z]*' | head -n1)
|
||||
if printf '%s\n' "$3" "$v" | sort --version-sort --check &>/dev/null; then
|
||||
echo "ok, found $v"
|
||||
return 0;
|
||||
else
|
||||
echo "ERROR: found version $v, too old!"
|
||||
return 1;
|
||||
fi
|
||||
}
|
||||
|
||||
find_executable() {
|
||||
paths=("/usr/sbin" "/sbin")
|
||||
|
||||
|
|
Loading…
Reference in a new issue