Let CMake check the presence of GNU utils

In list-licenses.sh it's too late ... the build simply continues if
list-licenses.sh returns with a non-zero exit code.
This commit is contained in:
Robert Schulze 2022-06-21 23:46:38 +02:00
parent 76bd2533a3
commit 287a7f6e98
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
2 changed files with 13 additions and 8 deletions

View File

@ -178,3 +178,15 @@ if (STRIP_PATH)
else ()
message (FATAL_ERROR "Cannot find strip.")
endif ()
if (OS_DARWIN)
# utils/list-licenses/list-licenses.sh (which generates system table system.licenses) needs the GNU versions of find and grep
find_program(GFIND_PATH NAMES "gfind")
if (NOT GFIND_PATH)
message (FATAL_ERROR "GNU find not found. You can install it with 'brew findutils'.")
endif()
find_program(GGREP_PATH NAMES "ggrep")
if (NOT GGREP_PATH)
message (FATAL_ERROR "GNU grep not found. You can install it with 'brew grep'.")
endif()
endif ()

View File

@ -1,14 +1,7 @@
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! [ -x "$(command -v ggrep)" ]; then
echo 'Error: GNU grep not found. You can install it with "brew grep".' >&2
exit 1
fi
if ! [ -x "$(command -v gfind)" ]; then
echo 'Error: GNU find not found. You can install it with "brew findutils".' >&2
exit 1
fi
# use GNU versions, their presence is ensured in cmake/tools.cmake
GREP_CMD=ggrep
FIND_CMD=gfind
else