[PATCH] D46522: [clang] cmake: resolve symlinks in ClangConfig.cmake

Peter Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 7 06:01:13 PDT 2018


Lekensteyn created this revision.
Lekensteyn added a reviewer: sylvestre.ledru.
Herald added subscribers: cfe-commits, mgorny.

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


Repository:
  rC Clang

https://reviews.llvm.org/D46522

Files:
  cmake/modules/CMakeLists.txt


Index: cmake/modules/CMakeLists.txt
===================================================================
--- cmake/modules/CMakeLists.txt
+++ cmake/modules/CMakeLists.txt
@@ -30,10 +30,10 @@
 # Generate ClangConfig.cmake for the install tree.
 set(CLANG_CONFIG_CODE "
 # Compute the installation prefix from this LLVMConfig.cmake file location.
-get_filename_component(CLANG_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
+get_filename_component(CLANG_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 "${CLANG_INSTALL_PACKAGE_DIR}")
+string(REGEX REPLACE "/" ";" _count "prefix/${CLANG_INSTALL_PACKAGE_DIR}")
 foreach(p ${_count})
   set(CLANG_CONFIG_CODE "${CLANG_CONFIG_CODE}
 get_filename_component(CLANG_INSTALL_PREFIX \"\${CLANG_INSTALL_PREFIX}\" PATH)")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46522.145451.patch
Type: text/x-patch
Size: 926 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180507/c206c477/attachment.bin>


More information about the cfe-commits mailing list