cmake: resolve symlinks in LLVMConfig.cmake
authorPeter Wu <peter@lekensteyn.nl>
Fri, 4 May 2018 13:43:06 +0000 (15:43 +0200)
committerGianfranco Costamagna <locutusofborg@debian.org>
Wed, 17 Oct 2018 09:00:09 +0000 (10:00 +0100)
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

Gbp-Pq: Name 0001-llvm-cmake-resolve-symlinks-in-LLVMConfig.cmake.patch

cmake/modules/CMakeLists.txt

index 6c316a2f04fb5f5cbca980b2a2c4cc3abeb38c87..195f23e1a06957b2f7c56e2a79b8dc07b995ed4e 100644 (file)
@@ -82,10 +82,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)")