Files
Echoion/scripts/configured-cxx-compiler.sh
faumaray 639362fbf5 Update
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-16 19:59:57 +03:00

28 lines
574 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [[ $# != 1 ]]; then
echo "usage: $0 BUILD_DIR" >&2
exit 2
fi
cache=$(realpath -e -- "$1/CMakeCache.txt")
compiler=
while IFS= read -r line; do
case $line in
CMAKE_CXX_COMPILER:FILEPATH=* | CMAKE_CXX_COMPILER:STRING=*)
[[ -z $compiler ]] || {
echo "duplicate CMAKE_CXX_COMPILER entries in $cache" >&2
exit 2
}
compiler=${line#*=}
;;
esac
done <"$cache"
[[ $compiler == /* && -x $compiler ]] || {
echo "CMake cache has no executable absolute C++ compiler: $cache" >&2
exit 2
}
realpath -e -- "$compiler"