forked from OSchip/llvm-project
[CMake] Use write_basic_package_version_file for LLVM
Use the CMake 3.13 features of CMakeConfigPackageHelpers to generate LLVMConfigVersion.cmake with proper architecture detection, major+minor version matching, etc. Differential Revision: https://reviews.llvm.org/D99451
This commit is contained in:
parent
d3e7ee36f6
commit
3001d080c8
|
@ -127,11 +127,13 @@ configure_file(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
|
||||||
# Generate LLVMConfigVersion.cmake for build and install tree.
|
# Generate LLVMConfigVersion.cmake for build tree (later copied to install tree).
|
||||||
configure_file(
|
include(CMakePackageConfigHelpers)
|
||||||
LLVMConfigVersion.cmake.in
|
write_basic_package_version_file(
|
||||||
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
|
"${llvm_cmake_builddir}/LLVMConfigVersion.cmake"
|
||||||
@ONLY)
|
VERSION "${PACKAGE_VERSION}"
|
||||||
|
COMPATIBILITY SameMinorVersion
|
||||||
|
)
|
||||||
|
|
||||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||||
get_property(llvm_has_exports GLOBAL PROPERTY LLVM_HAS_EXPORTS)
|
get_property(llvm_has_exports GLOBAL PROPERTY LLVM_HAS_EXPORTS)
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
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@.@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()
|
|
Loading…
Reference in New Issue