[llvm] r286184 - [CMake] Fix llvm_setup_rpath function
Mandeep Singh Grang via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 16:45:05 PST 2016
Author: mgrang
Date: Mon Nov 7 18:45:05 2016
New Revision: 286184
URL: http://llvm.org/viewvc/llvm-project?rev=286184&view=rev
Log:
[CMake] Fix llvm_setup_rpath function
Summary:
Set _install_rpath to CMAKE_INSTALL_RPATH if it is defined, so that eventually
INSTALL_RPATH is set to CMAKE_INSTALL_RPATH.
The "if(NOT DEFINED CMAKE_INSTALL_RPATH)" was missing a corresponding else
clause.
This also cleans up the fix made in r285908.
Patch by Azharuddin Mohammed
Reviewers: john.brawn, sgundapa, beanz
Subscribers: chapuni, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D26289
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=286184&r1=286183&r2=286184&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Mon Nov 7 18:45:05 2016
@@ -1342,6 +1342,10 @@ function(llvm_externalize_debuginfo name
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 @@ function(llvm_setup_rpath name)
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()
More information about the llvm-commits
mailing list