[Lldb-commits] [PATCH] D57989: [CMake] Fix RPATH handling for LLDB.framework

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 14 09:36:38 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdb85fdd11595: [CMake] Fix RPATH handling for LLDB.framework (authored by sgraenitz).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D57989?vs=186634&id=186861#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57989/new/

https://reviews.llvm.org/D57989

Files:
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -55,8 +55,9 @@
     message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms")
   endif()
   # CMake 3.6 did not correctly emit POST_BUILD commands for Apple Framework targets
-  if(CMAKE_VERSION VERSION_LESS 3.7)
-    message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
+  # CMake < 3.8 did not have the BUILD_RPATH target property
+  if(CMAKE_VERSION VERSION_LESS 3.8)
+    message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.8")
   endif()
 
   set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
Index: lldb/cmake/modules/AddLLDB.cmake
===================================================================
--- lldb/cmake/modules/AddLLDB.cmake
+++ lldb/cmake/modules/AddLLDB.cmake
@@ -175,23 +175,25 @@
 # added as an extra RPATH below.
 #
 function(lldb_setup_framework_rpaths_in_tool name)
-  # In the build-tree, we know the exact path to the binary in the framework.
-  set(rpath_build_tree "$<TARGET_FILE:liblldb>")
-
   # The installed framework is relocatable and can be in different locations.
-  set(rpaths_install_tree "@loader_path/../../../SharedFrameworks")
-  list(APPEND rpaths_install_tree "@loader_path/../../System/Library/PrivateFrameworks")
-  list(APPEND rpaths_install_tree "@loader_path/../../Library/PrivateFrameworks")
+  set(rpaths_install_tree)
 
   if(LLDB_FRAMEWORK_INSTALL_DIR)
-    set(rpaths_install_tree "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
+    list(APPEND rpaths_install_tree "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
   endif()
 
+  list(APPEND rpaths_install_tree "@loader_path/../../../SharedFrameworks")
+  list(APPEND rpaths_install_tree "@loader_path/../../System/Library/PrivateFrameworks")
+  list(APPEND rpaths_install_tree "@loader_path/../../Library/PrivateFrameworks")
+
+  # In the build-tree, we know the exact path to the framework directory.
+  get_target_property(framework_target_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+
   # If LLDB_NO_INSTALL_DEFAULT_RPATH was NOT enabled (default), this overwrites
   # the default settings from llvm_setup_rpath().
   set_target_properties(${name} PROPERTIES
     BUILD_WITH_INSTALL_RPATH OFF
-    BUILD_RPATH "${rpath_build_tree}"
+    BUILD_RPATH "${framework_target_dir}"
     INSTALL_RPATH "${rpaths_install_tree}"
   )
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57989.186861.patch
Type: text/x-patch
Size: 2537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190214/768c3286/attachment.bin>


More information about the lldb-commits mailing list