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

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 10:08:54 PST 2017


fjricci created this revision.
fjricci added reviewers: compnerd, beanz.
Herald added subscribers: Sanitizers, mgorny, dberris.

cmake's install function will automatically use the correct install
path: `$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}` when DESTINATION is supplied
a relative path. Don't try to force a custom path when we intend to
respect the user's configuration anyway.

To test, verify that install directory here is `/tmp/destdir/install`:

  cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/install
  DESTDIR=/tmp/destdir ninja install

An alternative solution to using '.' as a placeholder would be to not specify
`DESTINATION` at all for standalone builds, but we need to set this for in-tree
llvm builds, and it doesn't accept an empty argument, so we would need to
duplicate all of our install calls, to check whether COMPILER_RT_INSTALL_PATH is set,
which seems quite messy.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D41402

Files:
  cmake/base-config-ix.cmake


Index: cmake/base-config-ix.cmake
===================================================================
--- cmake/base-config-ix.cmake
+++ cmake/base-config-ix.cmake
@@ -49,7 +49,7 @@
     "Path where built compiler-rt libraries should be stored.")
   set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
     "Path where built compiler-rt executables should be stored.")
-  set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
+  set(COMPILER_RT_INSTALL_PATH . CACHE PATH
     "Path where built compiler-rt libraries should be installed.")
   option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
   option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41402.127556.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171219/9949bee8/attachment.bin>


More information about the llvm-commits mailing list