[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:30 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)
----------------
llvm-beanz wrote:

Why not just `CMAKE_SOURCE_DIR STRQUAL CMAKE_CURRENT_SOURCE_DIR`?  Really what we care about here is whether or not LLVM is the root CMake source directory, checking for a parent is kinda a roundabout way to get to that.

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


More information about the llvm-commits mailing list