Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -51,6 +51,7 @@ message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms") endif() + add_custom_target(lldb-framework) # These are used to fill out LLDB-Info.plist. These are relevant when building # the framework, and must be defined before building liblldb. set(PRODUCT_NAME "LLDB") @@ -60,6 +61,7 @@ set(LLDB_FRAMEWORK_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}) + include(LLDBFramework) endif() add_subdirectory(docs) @@ -162,10 +164,6 @@ add_subdirectory(utils/lldb-dotest) endif() -if (LLDB_BUILD_FRAMEWORK) - add_custom_target(lldb-framework) - include(LLDBFramework) -endif() if (NOT LLDB_DISABLE_PYTHON) # Add a Post-Build Event to copy over Python files and create the symlink Index: cmake/modules/AddLLDB.cmake =================================================================== --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -53,6 +53,11 @@ set(out_dir lib${LLVM_LIBDIR_SUFFIX}) if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK) set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}) + # The framework that is generated will install with install-liblldb + # because we enable CMake's framework support. CMake will copy all the + # headers and resources for us. + add_dependencies(install-lldb-framework install-${name}) + add_dependencies(install-lldb-framework-stripped install-${name}-stripped) endif() install(TARGETS ${name} COMPONENT ${name} @@ -67,12 +72,20 @@ endif() if (NOT CMAKE_CONFIGURATION_TYPES) add_llvm_install_targets(install-${name} - DEPENDS ${name} + DEPENDS $ COMPONENT ${name}) + + # install-liblldb{,-stripped} is the actual target that will install the + # framework, so it must rely on the framework being fully built first. + if (LLDB_BUILD_FRAMEWORK AND ${name} STREQUAL "liblldb") + add_dependencies(install-${name} lldb-framework) + add_dependencies(install-lldb-framework-stripped lldb-framework) + endif() endif() endif() endif() + # Hack: only some LLDB libraries depend on the clang autogenerated headers, # but it is simple enough to make all of LLDB depend on some of those # headers without negatively impacting much of anything. @@ -124,6 +137,10 @@ set(out_dir "bin") if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE) set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}) + # While install-liblldb-stripped will handle copying the tools, it will + # not strip them. We depend on this target to guarantee a stripped version + # will get installed in the framework. + add_dependencies(install-lldb-framework-stripped install-${name}-stripped) endif() install(TARGETS ${name} COMPONENT ${name} Index: cmake/modules/LLDBFramework.cmake =================================================================== --- cmake/modules/LLDBFramework.cmake +++ cmake/modules/LLDBFramework.cmake @@ -31,14 +31,9 @@ ) endif() -set_target_properties(liblldb PROPERTIES - OUTPUT_NAME LLDB - FRAMEWORK On - FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} - MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} - PUBLIC_HEADER "${framework_headers}") - add_dependencies(lldb-framework lldb-framework-headers lldb-suite) + +add_custom_target(install-lldb-framework) +add_custom_target(install-lldb-framework-stripped) Index: source/API/CMakeLists.txt =================================================================== --- source/API/CMakeLists.txt +++ source/API/CMakeLists.txt @@ -143,6 +143,17 @@ ) endif() +if (LLDB_BUILD_FRAMEWORK) + set_target_properties(liblldb + PROPERTIES + OUTPUT_NAME LLDB + FRAMEWORK On + FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist + LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR} + ) +endif() + if (LLDB_WRAP_PYTHON) add_dependencies(liblldb swig_wrapper) endif()