[Lldb-commits] [PATCH] D55319: [CMake] Proposal: Prefer LLDB_VERSION over plist value in EmbedAppleVersion.cmake

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 5 06:00:04 PST 2018


sgraenitz created this revision.
sgraenitz added reviewers: aprantl, friss.
Herald added a subscriber: mgorny.

LLDB_VERSION works analogous to CLANG_VERSION, with the exception that it includes the optional LLDB_VERSION_SUFFIX. Thus it should be equal to LLDB_VERSION_STRING and we could use it instead of extracting the plist value.

My preference would be to streamline version handling completely, including the code using it:

  if(APPLE)
    set(apple_version_inc "${CMAKE_CURRENT_BINARY_DIR}/AppleVersion.inc")
    set(apple_version_script "${LLDB_SOURCE_DIR}/cmake/modules/EmbedAppleVersion.cmake")
    set(info_plist ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist)
  
    # Create custom target to generate the VC revision include.
    add_custom_command(OUTPUT "${apple_version_inc}"
      DEPENDS "${apple_version_script}" "${info_plist}"
      COMMAND
      ${CMAKE_COMMAND} "-DLLDB_INFO_PLIST=${info_plist}"
                       "-DHEADER_FILE=${apple_version_inc}"
                       -P "${apple_version_script}")
  
    # Mark the generated header as being generated.
    set_source_files_properties("${apple_version_inc}"
      PROPERTIES GENERATED TRUE
                 HEADER_FILE_ONLY TRUE)
  
    # Tell Version.cpp that it needs to build with -DHAVE_SVN_VERSION_INC.
    set_property(SOURCE lldb.cpp APPEND PROPERTY 
                 COMPILE_DEFINITIONS "HAVE_APPLE_VERSION_INC")
    list(APPEND lldbBase_SOURCES ${apple_version_inc})
  else()

What do you think?


https://reviews.llvm.org/D55319

Files:
  cmake/modules/EmbedAppleVersion.cmake


Index: cmake/modules/EmbedAppleVersion.cmake
===================================================================
--- cmake/modules/EmbedAppleVersion.cmake
+++ cmake/modules/EmbedAppleVersion.cmake
@@ -1,6 +1,10 @@
-execute_process(COMMAND /usr/libexec/PlistBuddy -c "Print:CFBundleVersion" ${LLDB_INFO_PLIST}
-                OUTPUT_VARIABLE BundleVersion
-                OUTPUT_STRIP_TRAILING_WHITESPACE)
+if(LLDB_VERSION)
+  set(LLDB_VERSION_STRING ${LLDB_VERSION})
+else()
+  execute_process(COMMAND /usr/libexec/PlistBuddy -c "Print:CFBundleVersion" ${LLDB_INFO_PLIST}
+                  OUTPUT_VARIABLE BundleVersion
+                  OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
 
 file(APPEND "${HEADER_FILE}.tmp"
     "#define LLDB_VERSION_STRING lldb-${BundleVersion}\n")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55319.176802.patch
Type: text/x-patch
Size: 781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181205/1fb0412b/attachment.bin>


More information about the lldb-commits mailing list