llvm-toolchain/debian/patches/0001-llvm-cmake-resolve-symlinks-in-LLVMConfig.cmake.patch
Peter Wu 8ab8cd7b37 Make Clang cmake files more usable
* Move Clang*.cmake back to /usr/lib/llvm-X.Y/lib/cmake/clang and
  install a symlink in /usr/lib/cmake/clang-X.Y to ensure that CMake can
  still find it.
* Ensure that the LLVM installation prefix is correctly discovered
  despire symlinks (replaces fix-cmake-config-prefix.diff).
* Create /usr/lib/llvm-X.Y/bin/clang-6.0 symlink as required by
  ClangTargets-relwithdebinfo.cmake.
* Remove useless LLVM_CMAKE_DIR sed command that did not match anything.
* Ignore missing binaries in ClangTargets-relwithdebinfo.cmake.
* Add regression test to qualify-clang.sh.
2018-05-07 00:05:47 +02:00

35 lines
1.4 KiB
Diff

From d0d969074f6e0f975ad53d21e7ce6c7b40cf2957 Mon Sep 17 00:00:00 2001
From: Peter Wu <peter@lekensteyn.nl>
Date: Fri, 4 May 2018 15:43:06 +0200
Subject: [PATCH] [llvm] cmake: resolve symlinks in LLVMConfig.cmake
Ensure that symlinks such as /usr/lib/llvm-X.Y/cmake (pointing to
lib/cmake/llvm) are resolved. This ensures that LLVM_INSTALL_PREFIX
becomes /usr/lib/llvm-X.Y instead of /usr.
Partially addresses PR37128
---
cmake/modules/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 6074e835859..1cf4569b884 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -76,10 +76,10 @@ file(COPY .
# Generate LLVMConfig.cmake for the install tree.
set(LLVM_CONFIG_CODE "
# Compute the installation prefix from this LLVMConfig.cmake file location.
-get_filename_component(LLVM_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
+get_filename_component(LLVM_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" REALPATH)")
# Construct the proper number of get_filename_component(... PATH)
# calls to compute the installation prefix.
-string(REGEX REPLACE "/" ";" _count "${LLVM_INSTALL_PACKAGE_DIR}")
+string(REGEX REPLACE "/" ";" _count "prefix/${LLVM_INSTALL_PACKAGE_DIR}")
foreach(p ${_count})
set(LLVM_CONFIG_CODE "${LLVM_CONFIG_CODE}
get_filename_component(LLVM_INSTALL_PREFIX \"\${LLVM_INSTALL_PREFIX}\" PATH)")
--
2.17.0