mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 18:36:05 +00:00

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
43 lines
1.3 KiB
CMake
43 lines
1.3 KiB
CMake
if(LLDB_VERSION_STRING)
|
|
set(LLDB_FULL_VERSION_STRING LLDB_VERSION_STRING)
|
|
endif()
|
|
|
|
# Configure the VCSVersion.inc file.
|
|
set(vcs_version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
|
|
set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
|
|
|
|
find_first_existing_vc_file("${LLDB_SOURCE_DIR}" lldb_vc)
|
|
|
|
if(lldb_vc AND LLVM_APPEND_VC_REV)
|
|
set(lldb_source_dir ${LLDB_SOURCE_DIR})
|
|
endif()
|
|
|
|
add_custom_command(OUTPUT "${vcs_version_inc}"
|
|
DEPENDS "${lldb_vc}" "${generate_vcs_version_script}"
|
|
COMMAND ${CMAKE_COMMAND} "-DNAMES=LLDB"
|
|
"-DLLDB_SOURCE_DIR=${lldb_source_dir}"
|
|
"-DHEADER_FILE=${vcs_version_inc}"
|
|
-P "${generate_vcs_version_script}")
|
|
|
|
set_source_files_properties("${vcs_version_inc}"
|
|
PROPERTIES GENERATED TRUE
|
|
HEADER_FILE_ONLY TRUE)
|
|
|
|
# Configure the Version.inc file.
|
|
set(version_inc "${LLDB_BINARY_DIR}/include/lldb/Version/Version.inc")
|
|
|
|
configure_file(
|
|
${LLDB_SOURCE_DIR}/include/lldb/Version/Version.inc.in
|
|
${version_inc})
|
|
|
|
set_source_files_properties("${version_inc}"
|
|
PROPERTIES GENERATED TRUE
|
|
HEADER_FILE_ONLY TRUE)
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
add_lldb_library(lldbVersion
|
|
Version.cpp
|
|
${vcs_version_inc}
|
|
${version_inc})
|