upsj updated this revision to Diff 426628. upsj added a comment. fix standalone builds
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D124673/new/ https://reviews.llvm.org/D124673 Files: cmake/Modules/FindLibEdit.cmake lldb/CMakeLists.txt lldb/cmake/modules/FindLibEdit.cmake lldb/source/Core/CMakeLists.txt lldb/source/Host/CMakeLists.txt lldb/source/Interpreter/CMakeLists.txt lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt llvm/cmake/config-ix.cmake llvm/lib/LineEditor/CMakeLists.txt llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn +++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn @@ -142,7 +142,7 @@ # list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS}) # endif() # if (LLDB_ENABLE_LIBEDIT) - # list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES}) + # list(APPEND EXTRA_LIBS LibEdit::LibEdit) # endif() # if (LLDB_ENABLE_LZMA) # list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES}) Index: llvm/lib/LineEditor/CMakeLists.txt =================================================================== --- llvm/lib/LineEditor/CMakeLists.txt +++ llvm/lib/LineEditor/CMakeLists.txt @@ -1,5 +1,5 @@ if(HAVE_LIBEDIT) - set(link_libs edit) + set(link_libs LibEdit::LibEdit) endif() add_llvm_component_library(LLVMLineEditor Index: llvm/cmake/config-ix.cmake =================================================================== --- llvm/cmake/config-ix.cmake +++ llvm/cmake/config-ix.cmake @@ -64,7 +64,6 @@ check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) check_include_file(mach/mach.h HAVE_MACH_MACH_H) -check_include_file(histedit.h HAVE_HISTEDIT_H) check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) if(APPLE) include(CheckCSourceCompiles) @@ -184,8 +183,9 @@ # Don't look for these libraries on Windows. if (NOT PURE_WINDOWS) # Skip libedit if using ASan as it contains memory leaks. - if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") - check_library_exists(edit el_init "" HAVE_LIBEDIT) + if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") + find_package(LibEdit) + set(HAVE_LIBEDIT ${LibEdit_FOUND}) else() set(HAVE_LIBEDIT 0) endif() Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt =================================================================== --- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt +++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt @@ -10,7 +10,7 @@ if (LLDB_ENABLE_LIBEDIT) - list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES}) + list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit) endif() add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN @@ -35,9 +35,3 @@ LINK_COMPONENTS Support ) - -if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbPluginScriptInterpreterPython PUBLIC - ${LibEdit_INCLUDE_DIRS} - ) -endif() Index: lldb/source/Interpreter/CMakeLists.txt =================================================================== --- lldb/source/Interpreter/CMakeLists.txt +++ lldb/source/Interpreter/CMakeLists.txt @@ -68,6 +68,3 @@ LLDBInterpreterPropertiesGen LLDBInterpreterPropertiesEnumGen) -if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS}) -endif() Index: lldb/source/Host/CMakeLists.txt =================================================================== --- lldb/source/Host/CMakeLists.txt +++ lldb/source/Host/CMakeLists.txt @@ -141,7 +141,7 @@ list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS}) endif() if (LLDB_ENABLE_LIBEDIT) - list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES}) + list(APPEND EXTRA_LIBS LibEdit::LibEdit) endif() if (LLDB_ENABLE_LZMA) list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES}) @@ -151,7 +151,7 @@ endif() if (LLDB_ENABLE_LIBEDIT) - list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES}) + list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit) if (LLVM_BUILD_STATIC) list(APPEND LLDB_SYSTEM_LIBS gpm) endif() @@ -171,6 +171,3 @@ Support ) -if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS}) -endif() Index: lldb/source/Core/CMakeLists.txt =================================================================== --- lldb/source/Core/CMakeLists.txt +++ lldb/source/Core/CMakeLists.txt @@ -103,10 +103,6 @@ # TODO: Remove once we have better layering set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5) -if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS}) -endif() - if (LLDB_ENABLE_CURSES) target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIRS}) endif() Index: lldb/CMakeLists.txt =================================================================== --- lldb/CMakeLists.txt +++ lldb/CMakeLists.txt @@ -1,10 +1,15 @@ cmake_minimum_required(VERSION 3.13.4) +if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) + set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) +endif() + # Add path for custom modules. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" + "${LLVM_COMMON_CMAKE_UTILS}/Modules" ) # If we are not building as part of LLVM, build LLDB as a standalone project, Index: cmake/Modules/FindLibEdit.cmake =================================================================== --- cmake/Modules/FindLibEdit.cmake +++ cmake/Modules/FindLibEdit.cmake @@ -62,3 +62,9 @@ mark_as_advanced(LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) endif() +if (LibEdit_FOUND AND NOT TARGET LibEdit::LibEdit) + add_library(LibEdit::LibEdit UNKNOWN IMPORTED) + set_target_properties(LibEdit::LibEdit PROPERTIES + IMPORTED_LOCATION ${LibEdit_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${LibEdit_INCLUDE_DIRS}) +endif()
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits