Spurious `/usr` prefixed to `CMAKE_INSTALL_PREFIX` during LLVM 14 installation

I’ve only noticed this problem since version 14.

I compile the llvm-project using -DCMAKE_INSTALL_PREFIX=/ and yet, a lot of binaries like clang++ end up in /usr/bin.

Has anyone else noticed this problem?

We also use -DCMAKE_INSTALL_PREFIX=/ (I think we actually use -DCMAKE_INSTALL_PREFIX=, which CMake converts to / internally), and pair it with the DESTDIR environment variable to determine the actual installation location. We haven’t noticed any behavior changes with Clang 14. What’s your install command?

I have been able to reproduce the erroneous behavior with the following commands:

wget https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.4/llvm-project-14.0.4.src.tar.xz
mkdir build && cd build
cmake ../llvm-project-14.0.4.src/llvm -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_INSTALL_PREFIX=/
make -j16
DESTDIR=../opt make install

A very interesting effect I have found is that this issue only happens with makefiles, not with ninja.