[llvm] Export `LLVM_VERSION_MAJOR` CMake variable to `PARENT_SCOPE` (PR #83346)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 08:21:35 PST 2024


================
@@ -28,6 +28,12 @@ if(NOT DEFINED LLVM_VERSION_SUFFIX)
   set(LLVM_VERSION_SUFFIX git)
 endif()
 
+# Export a few LLVM version identifiers for users who use LLVM as a subdir.
+get_directory_property(_LLVM_HAS_PARENT_DIRECTORY PARENT_DIRECTORY)
+if (_LLVM_HAS_PARENT_DIRECTORY)
+  set(LLVM_VERSION_MAJOR "${LLVM_VERSION_MAJOR}" PARENT_SCOPE)
----------------
llvm-beanz wrote:

note: If you set these as properties instead of variables, I don't think there is any need to only set them conditionally, they can just always be set.

https://github.com/llvm/llvm-project/pull/83346


More information about the llvm-commits mailing list