[Lldb-commits] [PATCH] D13995: [cmake] Fix cmake build on OSX after r250335 for older versions of cmake

Dawn Perchik via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 22 14:25:49 PDT 2015


dawn created this revision.
dawn added reviewers: brucem, sas, krytarowski, enlight, labath.
dawn added a subscriber: lldb-commits.
dawn set the repository for this revision to rL LLVM.

Older versions of cmake don't support the -E env option which was added in r250335, causing the build to fail with:

    [...]
    [2632/2743] Linking CXX executable bin/debugserver
    FAILED: : && /usr/bin/c++   -std=c++11 -stdlib=libc++ [...]
     -o bin/debugserver  lib/liblldbDebugserverCommon.a lib/liblldbUtility.a lib/liblldbDebugserverMacOSX_I386.a lib/liblldbDebugserverMacOSX_X86_64.a -framework Cocoa -Wl,-rpath, at executable_path/../lib && cd /Users/testuser/build/workspace/LLVM-Clang-LLDB_master_release_OSX/llvm/build_ninja/bin && /usr/local/Cellar/cmake/3.0.2/bin/cmake -E env CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate codesign --force --sign lldb_codesign debugserver
    CMake Error: cmake version 3.0.2
    Usage: /usr/local/Cellar/cmake/3.0.2/bin/cmake -E [command] [arguments ...]
    Available commands:
      chdir dir cmd [args]...   - run command in a given directory
    [...]

This patch fixes this by invoking codesigning as it was before the commit if the cmake version is less than than 3.2.

Repository:
  rL LLVM

http://reviews.llvm.org/D13995

Files:
  tools/debugserver/source/MacOSX/CMakeLists.txt

Index: tools/debugserver/source/MacOSX/CMakeLists.txt
===================================================================
--- tools/debugserver/source/MacOSX/CMakeLists.txt
+++ tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -66,13 +66,23 @@
   OUTPUT_STRIP_TRAILING_WHITESPACE
   OUTPUT_VARIABLE CODESIGN_ALLOCATE
   )
-add_custom_command(TARGET debugserver
-  POST_BUILD
-  # --entitlements option removed, as it causes errors when debugging.
-  #was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver
-  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
-  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+# Older cmake versions don't support "-E env".
+if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 3.2)
+  add_custom_command(TARGET debugserver
+    POST_BUILD
+    # Note: --entitlements option removed, as it causes errors when debugging.
+    # was: COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --entitlements ${CMAKE_CURRENT_SOURCE_DIR}/../debugserver-entitlements.plist --force --sign ${CODESIGN_IDENTITY} debugserver
+    COMMAND CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
   )
+else()
+  add_custom_command(TARGET debugserver
+    POST_BUILD
+    # Note: --entitlements option removed (see comment above).
+    COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE} codesign --force --sign ${CODESIGN_IDENTITY} debugserver
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+  )
+endif()
 
 install(TARGETS debugserver
   RUNTIME DESTINATION bin


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13995.38176.patch
Type: text/x-patch
Size: 1794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151022/996e1f01/attachment.bin>


More information about the lldb-commits mailing list