[lldb] Make lldbVersion a full fledged library
Because of its dependency on clang (and potentially other compilers
downstream, such as swift) lldb_private::GetVersion already lives in its
own library called lldbBase. Despite that, its implementation was spread
across unrelated files. This patch improves things by introducing a
Version library with its own directory, header and implementation file.
The benefits of this patch include:
- We can get rid of the ugly quoting macros.
- Other parts of LLDB can read the version number from
lldb/Version/Version.inc.
- The implementation can be swapped out for tools like lldb-server than
don't need to depend on clang at all.
Differential revision: https://reviews.llvm.org/D115211
diff --git a/lldb/source/CMakeLists.txt b/lldb/source/CMakeLists.txt
index 6cc89a9..54e7903 100644
--- a/lldb/source/CMakeLists.txt
+++ b/lldb/source/CMakeLists.txt
@@ -1,41 +1,5 @@
-include_directories(.)
-
-set(lldbBase_SOURCES
- lldb.cpp
- )
-
-
-find_first_existing_vc_file("${LLDB_SOURCE_DIR}" lldb_vc)
-
-set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
-set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
-
-if(lldb_vc AND LLVM_APPEND_VC_REV)
- set(lldb_source_dir ${LLDB_SOURCE_DIR})
-endif()
-
-add_custom_command(OUTPUT "${version_inc}"
- DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
- COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
- "-DLLDB_SOURCE_DIR=${lldb_source_dir}"
- "-DHEADER_FILE=${version_inc}"
- -P "${generate_vcs_version_script}")
-
-# Mark the generated header as being generated.
-set_source_files_properties("${version_inc}"
- PROPERTIES GENERATED TRUE
- HEADER_FILE_ONLY TRUE)
-
-list(APPEND lldbBase_SOURCES ${version_inc})
-
-if(LLDB_VERSION_STRING)
- set_property(SOURCE lldb.cpp APPEND PROPERTY
- COMPILE_DEFINITIONS "LLDB_VERSION_STRING=${LLDB_VERSION_STRING}")
-endif()
-
-add_lldb_library(lldbBase
- ${lldbBase_SOURCES}
- )
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(Breakpoint)
add_subdirectory(Commands)
@@ -49,6 +13,7 @@
add_subdirectory(Symbol)
add_subdirectory(Target)
add_subdirectory(Utility)
+add_subdirectory(Version)
# Build API last. Since liblldb needs to link against every other target, it needs
# those targets to have already been created.