[PATCH] D41402: [cmake] Fix DESTDIR support in compiler-rt build

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 10:58:52 PST 2018

smeenai added a comment.

This does seem like the cleanest solution to me (though I'm not comfortable enough with compiler-rt's build system to approve this).

To give @beanz a bit more context, we're configuring a standalone compiler-rt build where (for various reasons that aren't really easy to change) the install destination is determined after CMake configuration, and so we wanna use `DESTDIR` to completely control the installation directory. We achieve this by setting `CMAKE_INSTALL_PREFIX` to `/` and `DESTDIR` to our desired install path. compiler-rt is unhappy with this setup, however, since its install destinations of the form `${COMPILER_RT_INSTALL_PATH}/...` then end up starting with `//`, and CMake interprets this as a network path and complains about network paths being incompatible with `DESTDIR`.

Stripping any trailing slashes from `CMAKE_INSTALL_PREFIX` won't work in this case because `COMPILER_RT_INSTALL_PATH` will then end up empty, which also causes CMake errors. Setting `CMAKE_INSTALL_PREFIX` to `/.` (to avoid ending up with the problematic `//`) on our end instead works, but it's pretty hacky, and this patch definitely feels cleaner than that. This patch also avoids absolute paths in the install commands, which appear to be discouraged anyway (judging by the existence of `CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION` and `CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION`).

  rCRT Compiler Runtime


More information about the llvm-commits mailing list