build-lldb-mi: Disallow detecting LLVM outside of $LLVM_DIR

Do the same as when cross compiling; disallow detecting dependencies
outside of the given CMAKE_FIND_ROOT_PATH. Don't export LLVM_DIR
as we no longer need to pass it implicitly that way.

This makes the errors clearer, if LLVM isn't found where expected,
instead of misdetecting it from a different installation of LLVM
in the system.

If lldb-mi would try to find other optional dependencies, they would
no longer be found; this was already the case when cross compiling
though.
This commit is contained in:
Martin Storsjö committed 2025-06-25 11:51:06 +03:00
1 parent d69ccd33a7
commit 9e628b0f2d
1 file changed
+8 -8
+8 -8
View File
@@ -65,7 +65,7 @@ else
esac
fi
export LLVM_DIR="$PREFIX"
LLVM_DIR="$PREFIX"
# Try to find/guess the builddir under the llvm buildtree next by.
# If LLVM was built without LLVM_INSTALL_TOOLCHAIN_ONLY, and the LLVM
@@ -91,7 +91,7 @@ if [ -d "$LLVM_SRC" ]; then
done
if [ -n "$DIRS" ]; then
dir="$(ls -td $DIRS | head -1)"
export LLVM_DIR="$LLVM_SRC/$dir"
LLVM_DIR="$LLVM_SRC/$dir"
echo Using $LLVM_DIR as LLVM build dir
break
else
@@ -121,14 +121,14 @@ if [ -n "$HOST" ]; then
exit 1
;;
esac
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH=$LLVM_DIR"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY"
fi
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH=$LLVM_DIR"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY"
if [ -n "$MACOS_REDIST" ]; then
: ${MACOS_REDIST_ARCHS:=arm64 x86_64}
: ${MACOS_REDIST_VERSION:=10.12}