[llvm] [cmake] Exposes LLVM version number in the runtimes. (PR #84641)
Mark de Wever via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 9 09:01:23 PST 2024
https://github.com/mordante created https://github.com/llvm/llvm-project/pull/84641
This allows sharing the LLVM version number in libc++.
>From 7857ec911aa109d1cf2913c5db3c9598250f037c Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Sat, 9 Mar 2024 17:58:41 +0100
Subject: [PATCH] [cmake] Exposes LLVM version number in the runtimes.
This allows sharing the LLVM version number in libc++.
---
cmake/Modules/LLVMVersion.cmake | 15 +++++++++++++++
llvm/CMakeLists.txt | 13 +------------
runtimes/CMakeLists.txt | 2 ++
3 files changed, 18 insertions(+), 12 deletions(-)
create mode 100644 cmake/Modules/LLVMVersion.cmake
diff --git a/cmake/Modules/LLVMVersion.cmake b/cmake/Modules/LLVMVersion.cmake
new file mode 100644
index 00000000000000..5e28283fbc1c60
--- /dev/null
+++ b/cmake/Modules/LLVMVersion.cmake
@@ -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()
+
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 111c8cfa15d828..02162fce24293c 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -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}")
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 29b47b862c219c..6f24fbcccec955 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -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
More information about the llvm-commits
mailing list