aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorJack Andersen <jackoalan@gmail.com>2021-12-05 14:45:33 -0500
committerJack Andersen <jackoalan@gmail.com>2021-12-05 14:46:23 -0500
commitb66339575a9b541e67ce5ad2ba7e88da07cf9305 (patch)
treef8aad66c46b523ae0ce11815d93494dbfb7e3419 /llvm/lib
parent296ebeb808a71e44a64e0f805cffc6e3a3bf6182 (diff)
downloadllvm-b66339575a9b541e67ce5ad2ba7e88da07cf9305.zip
llvm-b66339575a9b541e67ce5ad2ba7e88da07cf9305.tar.gz
llvm-b66339575a9b541e67ce5ad2ba7e88da07cf9305.tar.bz2
[CMake] Installable find modules for terminfo and libffi
Improves cross-distro portability of LLVM cmake package by resolving paths for terminfo and libffi via import targets. When LLVMExports.cmake is generated for installation, it contains absolute library paths which are likely to be a common cause of portability issues. To mitigate this, the discovery logic for these dependencies is refactored into find modules which get installed alongside LLVMConfig.cmake. The result is cleaner, cmake-friendly management of these dependencies that respect the environment of the LLVM package importer. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D114327
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt10
-rw-r--r--llvm/lib/Support/CMakeLists.txt7
2 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
index 9762198..14522ba 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
@@ -1,11 +1,3 @@
-# Make sure that the path to libffi headers is on the command
-# line. That path can be a compiler's non-default path even when
-# FFI_INCLUDE_DIR was not used, because cmake has its own paths for
-# searching for headers (CMAKE_SYSTEM_INCLUDE_PATH, for instance):
-if( FFI_INCLUDE_PATH )
- include_directories( ${FFI_INCLUDE_PATH} )
-endif()
-
add_llvm_component_library(LLVMInterpreter
Execution.cpp
ExternalFunctions.cpp
@@ -22,5 +14,5 @@ add_llvm_component_library(LLVMInterpreter
)
if( LLVM_ENABLE_FFI )
- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} )
+ target_link_libraries( LLVMInterpreter PRIVATE FFI::ffi )
endif()
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 6ce682d..7e9fdd0 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -45,7 +45,7 @@ elseif( CMAKE_HOST_UNIX )
set(system_libs ${system_libs} ${Backtrace_LIBFILE})
endif()
if( LLVM_ENABLE_TERMINFO )
- set(imported_libs ${imported_libs} "${TERMINFO_LIB}")
+ set(imported_libs ${imported_libs} Terminfo::terminfo)
endif()
if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) )
set(system_libs ${system_libs} atomic)
@@ -287,7 +287,10 @@ if(LLVM_ENABLE_ZLIB)
endif()
if(LLVM_ENABLE_TERMINFO)
- get_library_name(${TERMINFO_LIB} terminfo_library)
+ if(NOT terminfo_library)
+ get_property(terminfo_library TARGET Terminfo::terminfo PROPERTY LOCATION)
+ endif()
+ get_library_name(${terminfo_library} terminfo_library)
set(llvm_system_libs ${llvm_system_libs} "${terminfo_library}")
endif()