[PATCH] D26289: [CMake] Fix llvm_setup_rpath function

Mandeep Singh Grang via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 16:54:45 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL286184: [CMake] Fix llvm_setup_rpath function (authored by mgrang).

Changed prior to commit:
  https://reviews.llvm.org/D26289?vs=77083&id=77121#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26289

Files:
  llvm/trunk/cmake/modules/AddLLVM.cmake


Index: llvm/trunk/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake
+++ llvm/trunk/cmake/modules/AddLLVM.cmake
@@ -1342,6 +1342,10 @@
 endfunction()
 
 function(llvm_setup_rpath name)
+  if(CMAKE_INSTALL_RPATH)
+    return()
+  endif()
+
   if(LLVM_INSTALL_PREFIX AND NOT (LLVM_INSTALL_PREFIX STREQUAL CMAKE_INSTALL_PREFIX))
     set(extra_libdir ${LLVM_LIBRARY_DIR})
   elseif(LLVM_BUILD_LIBRARY_DIR)
@@ -1352,25 +1356,21 @@
     set(_install_name_dir INSTALL_NAME_DIR "@rpath")
     set(_install_rpath "@loader_path/../lib" ${extra_libdir})
   elseif(UNIX)
-    if(NOT DEFINED CMAKE_INSTALL_RPATH)
-      set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-      if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
-        set_property(TARGET ${name} APPEND_STRING PROPERTY
-                     LINK_FLAGS " -Wl,-z,origin ")
-      elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT LLVM_LINKER_IS_GOLD)
-        # $ORIGIN is not interpreted at link time by ld.bfd
-        set_property(TARGET ${name} APPEND_STRING PROPERTY
-                     LINK_FLAGS " -Wl,-rpath-link,${LLVM_LIBRARY_OUTPUT_INTDIR} ")
-      endif()
+    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+    if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+      set_property(TARGET ${name} APPEND_STRING PROPERTY
+                   LINK_FLAGS " -Wl,-z,origin ")
+    elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT LLVM_LINKER_IS_GOLD)
+      # $ORIGIN is not interpreted at link time by ld.bfd
+      set_property(TARGET ${name} APPEND_STRING PROPERTY
+                   LINK_FLAGS " -Wl,-rpath-link,${LLVM_LIBRARY_OUTPUT_INTDIR} ")
     endif()
   else()
     return()
   endif()
 
-  if(DEFINED _install_rpath)
-    set_target_properties(${name} PROPERTIES
-                          BUILD_WITH_INSTALL_RPATH On
-                          INSTALL_RPATH "${_install_rpath}"
-                          ${_install_name_dir})
-  endif()
+  set_target_properties(${name} PROPERTIES
+                        BUILD_WITH_INSTALL_RPATH On
+                        INSTALL_RPATH "${_install_rpath}"
+                        ${_install_name_dir})
 endfunction()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26289.77121.patch
Type: text/x-patch
Size: 2292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161108/9e088b26/attachment.bin>


More information about the llvm-commits mailing list