File: 0001-tools-clang-cmake-resolve-symlinks-in-ClangConfig.cmake.patch

package info (click to toggle)
llvm-toolchain-18 1%3A18.1.8-18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,908,340 kB
  • sloc: cpp: 6,667,937; ansic: 1,440,452; asm: 883,619; python: 230,549; objc: 76,880; f90: 74,238; lisp: 35,989; pascal: 16,571; sh: 10,229; perl: 7,459; ml: 5,047; awk: 3,523; makefile: 2,987; javascript: 2,149; xml: 892; fortran: 649; cs: 573
file content (31 lines) | stat: -rw-r--r-- 1,712 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From c830d84bc802ca1e9219415a5784c4ad97a34819 Mon Sep 17 00:00:00 2001
From: Peter Wu <peter@lekensteyn.nl>
Date: Fri, 4 May 2018 15:55:26 +0200
Subject: [PATCH] [clang] cmake: resolve symlinks in ClangConfig.cmake

Ensure that symlinks such as /usr/lib/cmake/clang-X.Y (pointing to
/usr/lib/llvm-X.Y/lib/cmake/llvm) are resolved. This ensures that
CLANG_INSTALL_PREFIX ends up to be /usr/lib/llvm-X.Y instead of /usr.

Partially addresses PR37128
---
 cmake/modules/CMakeLists.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: llvm-toolchain-snapshot_15~++20220726081233+0df7d8bc355d/cmake/Modules/FindPrefixFromConfig.cmake
===================================================================
--- llvm-toolchain-snapshot_15~++20220726081233+0df7d8bc355d.orig/cmake/Modules/FindPrefixFromConfig.cmake
+++ llvm-toolchain-snapshot_15~++20220726081233+0df7d8bc355d/cmake/Modules/FindPrefixFromConfig.cmake
@@ -39,10 +39,10 @@ function(find_prefix_from_config out_var
     # install prefix, and avoid hard-coding any absolute paths.
     set(config_code
       "# Compute the installation prefix from this LLVMConfig.cmake file location."
-      "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
+      "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" REALPATH)")
     # Construct the proper number of get_filename_component(... PATH)
     # calls to compute the installation prefix.
-    string(REGEX REPLACE "/" ";" _count "${path_to_leave}")
+    string(REGEX REPLACE "/" ";" _count "prefix/${path_to_leave}")
     foreach(p ${_count})
       list(APPEND config_code
         "get_filename_component(${prefix_var} \"\${${prefix_var}}\" PATH)")