[llvm] r206426 - Teach LLVMConfigVersion.cmake to behave as find_package() expects.
Eric Christopher
echristo at gmail.com
Wed Apr 16 16:15:31 PDT 2014
Author: echristo
Date: Wed Apr 16 18:15:31 2014
New Revision: 206426
URL: http://llvm.org/viewvc/llvm-project?rev=206426&view=rev
Log:
Teach LLVMConfigVersion.cmake to behave as find_package() expects.
Patch by Brad King
Modified:
llvm/trunk/cmake/modules/LLVMConfigVersion.cmake.in
llvm/trunk/cmake/modules/Makefile
Modified: llvm/trunk/cmake/modules/LLVMConfigVersion.cmake.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfigVersion.cmake.in?rev=206426&r1=206425&r2=206426&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVMConfigVersion.cmake.in (original)
+++ llvm/trunk/cmake/modules/LLVMConfigVersion.cmake.in Wed Apr 16 18:15:31 2014
@@ -1 +1,13 @@
-set(PACKAGE_VERSION "@PACKAGE_VERSION@")
\ No newline at end of file
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR at .@LLVM_VERSION_MINOR@" VERSION_EQUAL
+ "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+ AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+ "${PACKAGE_FIND_VERSION_PATCH}")
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
Modified: llvm/trunk/cmake/modules/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/Makefile?rev=206426&r1=206425&r2=206426&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/Makefile (original)
+++ llvm/trunk/cmake/modules/Makefile Wed Apr 16 18:15:31 2014
@@ -52,6 +52,9 @@ $(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake:
$(Echo) 'Generating LLVM CMake package version file'
$(Verb) cat $< | sed \
-e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
+ -e 's/@LLVM_VERSION_MAJOR@/'"$(LLVM_VERSION_MAJOR)"'/' \
+ -e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \
+ -e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
> $@
$(PROJ_OBJ_DIR)/LLVMExports.cmake: $(LLVMBuildCMakeExportsFrag)
More information about the llvm-commits
mailing list