Skip to content

Commit

Permalink
[cmake] Exposes LLVM version number in the runtimes. (#84641)
Browse files Browse the repository at this point in the history
This allows sharing the LLVM version number in libc++.
  • Loading branch information
mordante authored Mar 11, 2024
1 parent 6cd68c2 commit 81e2047
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
15 changes: 15 additions & 0 deletions cmake/Modules/LLVMVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The LLVM Version number information

if(NOT DEFINED LLVM_VERSION_MAJOR)
set(LLVM_VERSION_MAJOR 19)
endif()
if(NOT DEFINED LLVM_VERSION_MINOR)
set(LLVM_VERSION_MINOR 0)
endif()
if(NOT DEFINED LLVM_VERSION_PATCH)
set(LLVM_VERSION_PATCH 0)
endif()
if(NOT DEFINED LLVM_VERSION_SUFFIX)
set(LLVM_VERSION_SUFFIX git)
endif()

13 changes: 1 addition & 12 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ if(NOT LLVM_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
endif()

if(NOT DEFINED LLVM_VERSION_MAJOR)
set(LLVM_VERSION_MAJOR 19)
endif()
if(NOT DEFINED LLVM_VERSION_MINOR)
set(LLVM_VERSION_MINOR 0)
endif()
if(NOT DEFINED LLVM_VERSION_PATCH)
set(LLVM_VERSION_PATCH 0)
endif()
if(NOT DEFINED LLVM_VERSION_SUFFIX)
set(LLVM_VERSION_SUFFIX git)
endif()
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/LLVMVersion.cmake)

set_directory_properties(PROPERTIES LLVM_VERSION_MAJOR "${LLVM_VERSION_MAJOR}")

Expand Down
2 changes: 2 additions & 0 deletions runtimes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
NO_POLICY_SCOPE)

include(${LLVM_COMMON_CMAKE_UTILS}/Modules/LLVMVersion.cmake)

project(Runtimes C CXX ASM)

list(INSERT CMAKE_MODULE_PATH 0
Expand Down

0 comments on commit 81e2047

Please sign in to comment.