[Lldb-commits] [lldb] r289841 - [CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later
Chris Bieneman via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 15 10:18:47 PST 2016
Author: cbieneman
Date: Thu Dec 15 12:18:47 2016
New Revision: 289841
URL: http://llvm.org/viewvc/llvm-project?rev=289841&view=rev
Log:
[CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later
CMake's framework target generation was unable to generate POST_BUILD steps (see: https://gitlab.kitware.com/cmake/cmake/issues/16363).
It turns out working around this is really not reasonable. The more reasonable solution to me is just to not support LLDB.framework unless you are on CMake 3.7 or newer.
Since CMake 3.7.1 is released that's how I'm going to handle this.
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=289841&r1=289840&r2=289841&view=diff
==============================================================================
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Thu Dec 15 12:18:47 2016
@@ -8,6 +8,10 @@ include(${LLDB_PROJECT_ROOT}/cmake/LLDBD
option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
+if(LLDB_BUILD_FRAMEWORK AND CMAKE_VERSION VERSION_LESS 3.7)
+ message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
+endif()
+
if (LLDB_BUILD_FRAMEWORK AND NOT APPLE)
message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting Apple platforms.")
endif()
@@ -140,24 +144,11 @@ 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
+ add_custom_command(TARGET liblldb POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:liblldb>/Versions/${LLDB_FRAMEWORK_VERSION}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${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
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${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 ${symlink_commands})
- else()
- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/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()
endif()
Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=289841&r1=289840&r2=289841&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Thu Dec 15 12:18:47 2016
@@ -27,11 +27,6 @@ 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