[llvm] 188592f - Revert "[CMake] Use write_basic_package_version_file for LLVM"
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 29 13:08:14 PDT 2021
Author: Petr Hosek
Date: 2021-03-29T13:07:39-07:00
New Revision: 188592ff08ad552427083124cad12eb0ddd798ba
URL: https://github.com/llvm/llvm-project/commit/188592ff08ad552427083124cad12eb0ddd798ba
DIFF: https://github.com/llvm/llvm-project/commit/188592ff08ad552427083124cad12eb0ddd798ba.diff
LOG: Revert "[CMake] Use write_basic_package_version_file for LLVM"
This reverts commit 3001d080c813da20b329303bf8f45451480e5905 which
seems to have introduced a race condition that's failing the build
in some cases.
Added:
llvm/cmake/modules/LLVMConfigVersion.cmake.in
Modified:
llvm/cmake/modules/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
index 8276126e9eda..505dc9a29d70 100644
--- a/llvm/cmake/modules/CMakeLists.txt
+++ b/llvm/cmake/modules/CMakeLists.txt
@@ -127,13 +127,11 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
@ONLY)
-# Generate LLVMConfigVersion.cmake for build tree (later copied to install tree).
-include(CMakePackageConfigHelpers)
-write_basic_package_version_file(
- "${llvm_cmake_builddir}/LLVMConfigVersion.cmake"
- VERSION "${PACKAGE_VERSION}"
- COMPATIBILITY SameMinorVersion
-)
+# Generate LLVMConfigVersion.cmake for build and install tree.
+configure_file(
+ LLVMConfigVersion.cmake.in
+ ${llvm_cmake_builddir}/LLVMConfigVersion.cmake
+ @ONLY)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
get_property(llvm_has_exports GLOBAL PROPERTY LLVM_HAS_EXPORTS)
diff --git a/llvm/cmake/modules/LLVMConfigVersion.cmake.in b/llvm/cmake/modules/LLVMConfigVersion.cmake.in
new file mode 100644
index 000000000000..e9ac4ed2da78
--- /dev/null
+++ b/llvm/cmake/modules/LLVMConfigVersion.cmake.in
@@ -0,0 +1,13 @@
+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()
More information about the llvm-commits
mailing list