[LLVMdev] [PATCH] Prepend GCC_INSTALL_PREFIX to rpath if set.

Russell Harmon eatnumber1 at google.com
Thu May 29 23:25:24 PDT 2014


This patch just prepends the gcc install prefix to the rpath rather than
overriding it. It also uses the LLVM_LIBDIR_SUFFIX under the assumption that if
you want llvm to install to lib{32,64} that you also installed gcc under that
directory.

This way, an LLVM compiled after setting GCC_INSTALL_PREFIX will work correctly
if you don't want to install LLVM into the GCC_INSTALL_PREFIX.
---
 CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ec3e33..70684a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -451,6 +451,10 @@ if (APPLE)
 else(UNIX)
   if(NOT DEFINED CMAKE_INSTALL_RPATH)
     set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
+    if(DEFINED GCC_INSTALL_PREFIX)
+      set(CMAKE_INSTALL_RPATH "${GCC_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}:${CMAKE_INSTALL_RPATH}")
+    endif()
+
     if (${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
       set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,origin")
     endif()
-- 
1.9.1.423.g4596e3a




More information about the llvm-dev mailing list