[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath
authorRaul Tambre <raul@tambre.ee>
Thu, 7 Jan 2021 10:32:41 +0000 (12:32 +0200)
committerRaul Tambre <raul@tambre.ee>
Fri, 8 Jan 2021 06:31:10 +0000 (08:31 +0200)
commit0ebc1fb29f278db0665423f15c53e6ee9601dddb
tree5468b5d5aa45475024f3bf6f7b792f28e0b046ae
parentae25a397e9de833ffbd5d8e3b480086404625cb7
[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath

When `BUILD_WITH_INSTALL_RPATH` is enabled it prevents using a custom rpath only
for the build tree as the install rpath will be used. This makes it impossible to run a
runtimes build when compiling with Clang and wanting the installed rpath to be
empty (i.e. `-DCMAKE_BUILD_RPATH="<some path>" -DCMAKE_SKIP_INSTALL_RPATH=ON`).

Disable `BUILD_WITH_INSTALL_RPATH` when `CMAKE_BUILD_RPATH` is non-empty to
allow for such build scenarios.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D93177
llvm/cmake/modules/AddLLVM.cmake