[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:20:31 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:

I think it would be more idiomatic in CMake to set those values as directory or global properties, which would allow them to be accessed at any directory scope above using the `get_property` function.

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


More information about the llvm-commits mailing list