OSDN Git Service

Revert "[CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath"
authorRaul Tambre <raul@tambre.ee>
Fri, 8 Jan 2021 17:54:52 +0000 (19:54 +0200)
committerRaul Tambre <raul@tambre.ee>
Fri, 8 Jan 2021 17:59:20 +0000 (19:59 +0200)
This reverts commit 0ebc1fb29f278db0665423f15c53e6ee9601dddb.

The behaviour should have been the same as before unless specifying CMAKE_BUILD_RPATH,
which was previously broken.
However, this seems to have broken builds for some people that don't specify it.
Reverting until I can investigate.

Differential Revision: https://reviews.llvm.org/D94319

llvm/cmake/modules/AddLLVM.cmake

index dc06ea1..b86fbda 100644 (file)
@@ -865,13 +865,10 @@ macro(add_llvm_executable name)
 
   if(NOT ARG_NO_INSTALL_RPATH)
     llvm_setup_rpath(${name})
-  else()
-    # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
-    if(NOT "${CMAKE_BUILD_RPATH}" STREQUAL "")
-      set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
-    endif()
-
-    set_property(TARGET ${name} PROPERTY INSTALL_RPATH "${LLVM_LOCAL_RPATH}")
+  elseif (LLVM_LOCAL_RPATH)
+    set_target_properties(${name} PROPERTIES
+                          BUILD_WITH_INSTALL_RPATH On
+                          INSTALL_RPATH "${LLVM_LOCAL_RPATH}")
   endif()
 
   if(DEFINED windows_resource_file)
@@ -2116,12 +2113,8 @@ function(llvm_setup_rpath name)
     return()
   endif()
 
-  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
-  if(NOT "${CMAKE_BUILD_RPATH}" STREQUAL "")
-    set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
-  endif()
-
   set_target_properties(${name} PROPERTIES
+                        BUILD_WITH_INSTALL_RPATH On
                         INSTALL_RPATH "${_install_rpath}"
                         ${_install_name_dir})
 endfunction()