[Lldb-commits] [lldb] r285651 - [CMake] Populate the build directory's framework

Chris Bieneman via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 31 15:31:07 PDT 2016


Author: cbieneman
Date: Mon Oct 31 17:31:07 2016
New Revision: 285651

URL: http://llvm.org/viewvc/llvm-project?rev=285651&view=rev
Log:
[CMake] Populate the build directory's framework

This ensures that the Resources and clang headers are properly symlinked in LLDB's framework. This should fix the modules-related tests when building on Darwin with CMake if you are building a framework.

I have another fix coming which gets them working on Darwin if you're building liblldb instead of a framework.

Modified:
    lldb/trunk/source/API/CMakeLists.txt
    lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=285651&r1=285650&r2=285651&view=diff
==============================================================================
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Mon Oct 31 17:31:07 2016
@@ -140,16 +140,22 @@ if(LLDB_BUILD_FRAMEWORK)
     LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
     PUBLIC_HEADER "${public_headers}")
 
+  set(symlink_commands
+    COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:liblldb>
+    COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers
+    COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers 
+    COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
+    )
+
   # This works around a CMake bug where POST_BUILD steps are not applied to 
   # framework targets. This fix is merged into the CMake release branch and
   # should be available with CMake 3.7 rc2:
   # https://gitlab.kitware.com/cmake/cmake/issues/16363
   if(CMAKE_VERSION VERSION_GREATER 3.6.99)
-    add_custom_command(TARGET liblldb POST_BUILD
-      COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers)
+    add_custom_command(TARGET liblldb POST_BUILD ${symlink_commands})
   else()
     add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Headers
-      COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers)
+      ${symlink_commands})
     add_custom_target(lldb_header_symlink
       DEPENDS ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Headers)
   endif()

Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=285651&r1=285650&r2=285651&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Mon Oct 31 17:31:07 2016
@@ -27,6 +27,11 @@ if(TARGET lldb-mi)
   list(APPEND LLDB_TEST_DEPS lldb-mi)
 endif()
 
+# This target will only exist if the user is using a CMake older than 3.7
+if(TARGET lldb_header_symlink)
+  list(APPEND LLDB_TEST_DEPS lldb_header_symlink)
+endif()
+
 if ("${LLDB_TEST_COMPILER}" STREQUAL "")
     string(REGEX REPLACE ".*ccache\ +" "" LLDB_TEST_COMPILER ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
 endif()




More information about the lldb-commits mailing list