Meta: Also set CC/CXX when selecting the host toolchain

This ensures that the toolchain building scripts will use the host
toolchain that has been found manually, and that they won't fall back to
`cc` (which in the worst case may not even be installed).
This commit is contained in:
Tim Schumacher 2022-10-23 22:06:41 +00:00 committed by Linus Groh
parent 7ecc50db57
commit 40165a1c40
Notes: sideshowbarker 2024-07-17 05:09:54 +09:00

View file

@ -189,22 +189,20 @@ find_newest_compiler() {
pick_host_compiler() {
if is_supported_compiler "$CC" && is_supported_compiler "$CXX"; then
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=$CC")
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=$CXX")
return
fi
find_newest_compiler egcc gcc gcc-11 gcc-12 /usr/local/bin/gcc-11 /opt/homebrew/bin/gcc-11
if is_supported_compiler "$HOST_COMPILER"; then
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=$HOST_COMPILER")
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=${HOST_COMPILER/gcc/g++}")
export CC="${HOST_COMPILER}"
export CXX="${HOST_COMPILER/gcc/g++}"
return
fi
find_newest_compiler clang clang-13 clang-14 clang-15 /opt/homebrew/opt/llvm/bin/clang
if is_supported_compiler "$HOST_COMPILER"; then
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=$HOST_COMPILER")
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=${HOST_COMPILER/clang/clang++}")
export CC="${HOST_COMPILER}"
export CXX="${HOST_COMPILER/clang/clang++}"
return
fi
@ -213,7 +211,10 @@ pick_host_compiler() {
cmd_with_target() {
is_valid_target || ( >&2 echo "Unknown target: $TARGET"; usage )
pick_host_compiler
CMAKE_ARGS+=("-DCMAKE_C_COMPILER=${CC}")
CMAKE_ARGS+=("-DCMAKE_CXX_COMPILER=${CXX}")
if [ ! -d "$SERENITY_SOURCE_DIR" ]; then
SERENITY_SOURCE_DIR="$(get_top_dir)"