libc: Default LIBC_INSTALL_PREFIX to ${CMAKE_INSTALL_PREFIX}
authorNathan Chancellor <nathan@kernel.org>
Wed, 31 Mar 2021 04:08:18 +0000 (21:08 -0700)
committerNathan Chancellor <nathan@kernel.org>
Wed, 31 Mar 2021 04:43:25 +0000 (21:43 -0700)
commit4e0045cc9b00ed18a7b8981d468a9d01eb4f6780
treeacd8483e01518734c3ab4f7368d06ce2caa1d42d
parent0269a407f3afb7301594d9977093cb428d059935
libc: Default LIBC_INSTALL_PREFIX to ${CMAKE_INSTALL_PREFIX}

b22f448c21e718a3b6 added a rule to install libllvmlibc.a to
${LIBC_INSTALL_PREFIX}/${LIBC_INSTALL_LIBRARY_DIR}, which will be /lib
by default, which is disruptive to builds that stay within a user's
/home holder:

  $ ninja install
  ...
  -- Installing: /lib/libllvmlibc.a
  CMake Error at projects/libc/lib/cmake_install.cmake:54 (file):
    file INSTALL cannot copy file
   "/home/nathan/cbl/github/tc-build/build/llvm/stage1/projects/libc/lib/libllvmlibc.a"
    to "/lib/libllvmlibc.a": Permission denied.
  Call Stack (most recent call first):
    projects/libc/cmake_install.cmake:51 (include)
    projects/cmake_install.cmake:47 (include)
    cmake_install.cmake:76 (include)
  ...

Change LIBC_INSTALL_PREFIX's default value to ${CMAKE_INSTALL_PREFIX} so
that 'ninja install' does not attempt to install anything outside of the
user's requested installation location.

Differential Revision: https://reviews.llvm.org/D99636

Reviewed By: sivachandra

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
libc/CMakeLists.txt