[llvm] 7d89e6c - [CMake] Add missing find_package for LibEdit
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 15:35:12 PDT 2023
Author: Petr Hosek
Date: 2023-04-21T22:34:11Z
New Revision: 7d89e6c1c0a01c959beddab643e39d2bc4c2c97d
URL: https://github.com/llvm/llvm-project/commit/7d89e6c1c0a01c959beddab643e39d2bc4c2c97d
DIFF: https://github.com/llvm/llvm-project/commit/7d89e6c1c0a01c959beddab643e39d2bc4c2c97d.diff
LOG: [CMake] Add missing find_package for LibEdit
After building and installing LLVM with LibEdit as a dependency, it is
necessary to find it again when LLVM is consumed by another CMake
project, otherwise CMake will report an error about a missing target.
Note that the FindLibEdit.cmake file is in the "LLVM Common CMake
Utils" directory, outside of the LLVM sub-project source directory, so
the installed LLVMConfig.cmake relies on the user having installed the
LLVM common CMake modules or make available their own Find module.
Also note that the controlling HAVE_LIBEDIT CMake variable in
LLVMConfig.cmake.in has a different naming convention compared to
other similar variables like 'LLVM_ENABLE_TERMINFO'. Refactoring this
name would involve touching additional files and should be a follow-up
commit.
Patch By: ekilmer
Differential Revision: https://reviews.llvm.org/D147153
Added:
Modified:
llvm/cmake/config-ix.cmake
llvm/cmake/modules/LLVMConfig.cmake.in
Removed:
################################################################################
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 752ca333caa3b..2c815430432bf 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -220,8 +220,12 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
if (NOT PURE_WINDOWS)
# Skip libedit if using ASan as it contains memory leaks.
if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
- find_package(LibEdit)
- set(HAVE_LIBEDIT ${LibEdit_FOUND})
+ if(LLVM_ENABLE_LIBEDIT STREQUAL FORCE_ON)
+ find_package(LibEdit REQUIRED)
+ else()
+ find_package(LibEdit)
+ endif()
+ set(HAVE_LIBEDIT "${LibEdit_FOUND}")
else()
set(HAVE_LIBEDIT 0)
endif()
@@ -234,9 +238,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
set(LLVM_ENABLE_TERMINFO "${Terminfo_FOUND}")
endif()
else()
+ set(HAVE_LIBEDIT 0)
set(LLVM_ENABLE_TERMINFO 0)
endif()
else()
+ set(HAVE_LIBEDIT 0)
set(LLVM_ENABLE_TERMINFO 0)
endif()
diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index 2d90512bfb06e..42dfd607f7e65 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -58,6 +58,11 @@ endif()
set(LLVM_ENABLE_RTTI @LLVM_ENABLE_RTTI@)
+set(LLVM_ENABLE_LIBEDIT @HAVE_LIBEDIT@)
+if(LLVM_ENABLE_LIBEDIT)
+ find_package(LibEdit)
+endif()
+
set(LLVM_ENABLE_TERMINFO @LLVM_ENABLE_TERMINFO@)
if(LLVM_ENABLE_TERMINFO)
find_package(Terminfo)
More information about the llvm-commits
mailing list