Author: Jonas Devlieghere Date: 2020-01-02T13:39:57-08:00 New Revision: f38234ed8b579230a3742317ffd5fb95514d9638
URL: https://github.com/llvm/llvm-project/commit/f38234ed8b579230a3742317ffd5fb95514d9638 DIFF: https://github.com/llvm/llvm-project/commit/f38234ed8b579230a3742317ffd5fb95514d9638.diff LOG: [lldb/CMake] Fix variable naming in FindLibEdit The current FOUND_VAR for FindLibEdit is libedit_FOUND but wasn't set by find_package_handle_standard_args. However this isn't valid for the package name. The argument for FOUND_VAR is "libedit_FOUND", but only "LibEdit_FOUND" and "LIBEDIT_FOUND" are valid names. This fixes all the variables set by FindLibEdit to match the desired naming scheme. Added: Modified: lldb/cmake/modules/FindLibEdit.cmake lldb/cmake/modules/LLDBConfig.cmake lldb/source/Core/CMakeLists.txt lldb/source/Host/CMakeLists.txt lldb/source/Interpreter/CMakeLists.txt lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt Removed: ################################################################################ diff --git a/lldb/cmake/modules/FindLibEdit.cmake b/lldb/cmake/modules/FindLibEdit.cmake index df8f2abb0164..b4f0cb329811 100644 --- a/lldb/cmake/modules/FindLibEdit.cmake +++ b/lldb/cmake/modules/FindLibEdit.cmake @@ -8,25 +8,25 @@ # # :: # -# libedit_FOUND - true if libedit was found -# libedit_INCLUDE_DIRS - include search path -# libedit_LIBRARIES - libraries to link -# libedit_VERSION - version number +# LibEdit_FOUND - true if libedit was found +# LibEdit_INCLUDE_DIRS - include search path +# LibEdit_LIBRARIES - libraries to link +# LibEdit_VERSION_STRING - version number -if(libedit_INCLUDE_DIRS AND libedit_LIBRARIES) - set(libedit_FOUND TRUE) +if(LibEdit_INCLUDE_DIRS AND LibEdit_LIBRARIES) + set(LibEdit_FOUND TRUE) else() find_package(PkgConfig QUIET) pkg_check_modules(PC_LIBEDIT QUIET libedit) - find_path(libedit_INCLUDE_DIRS + find_path(LibEdit_INCLUDE_DIRS NAMES histedit.h HINTS ${PC_LIBEDIT_INCLUDEDIR} ${PC_LIBEDIT_INCLUDE_DIRS} ${CMAKE_INSTALL_FULL_INCLUDEDIR}) - find_library(libedit_LIBRARIES + find_library(LibEdit_LIBRARIES NAMES edit libedit HINTS @@ -34,29 +34,31 @@ else() ${PC_LIBEDIT_LIBRARY_DIRS} ${CMAKE_INSTALL_FULL_LIBDIR}) - if(libedit_INCLUDE_DIRS AND EXISTS "${libedit_INCLUDE_DIRS}/histedit.h") - file(STRINGS "${libedit_INCLUDE_DIRS}/histedit.h" + if(LibEdit_INCLUDE_DIRS AND EXISTS "${LibEdit_INCLUDE_DIRS}/histedit.h") + file(STRINGS "${LibEdit_INCLUDE_DIRS}/histedit.h" libedit_major_version_str REGEX "^#define[ \t]+LIBEDIT_MAJOR[ \t]+[0-9]+") string(REGEX REPLACE "^#define[ \t]+LIBEDIT_MAJOR[ \t]+([0-9]+)" "\\1" LIBEDIT_MAJOR_VERSION "${libedit_major_version_str}") - file(STRINGS "${libedit_INCLUDE_DIRS}/histedit.h" + file(STRINGS "${LibEdit_INCLUDE_DIRS}/histedit.h" libedit_minor_version_str REGEX "^#define[ \t]+LIBEDIT_MINOR[ \t]+[0-9]+") string(REGEX REPLACE "^#define[ \t]+LIBEDIT_MINOR[ \t]+([0-9]+)" "\\1" LIBEDIT_MINOR_VERSION "${libedit_minor_version_str}") - set(libedit_VERSION_STRING "${libedit_major_version}.${libedit_minor_version}") + set(LibEdit_VERSION_STRING "${libedit_major_version}.${libedit_minor_version}") endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LibEdit + FOUND_VAR + LibEdit_FOUND REQUIRED_VARS - libedit_INCLUDE_DIRS - libedit_LIBRARIES + LibEdit_INCLUDE_DIRS + LibEdit_LIBRARIES VERSION_VAR - libedit_VERSION_STRING) - mark_as_advanced(libedit_INCLUDE_DIRS libedit_LIBRARIES) + LibEdit_VERSION_STRING) + mark_as_advanced(LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) endif() diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 88f39f235277..b77880cc0af4 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -45,7 +45,7 @@ macro(add_optional_dependency variable description package found) endif() endmacro() -add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support." LibEdit libedit_FOUND) +add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support." LibEdit LibEdit_FOUND) add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support." CursesAndPanel CURSESANDPANEL_FOUND) add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support." LibLZMA LIBLZMA_FOUND) add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support." Lua LUA_FOUND) @@ -124,8 +124,8 @@ endif() # Check if we libedit capable of handling wide characters (built with # '--enable-widec'). if (LLDB_ENABLE_LIBEDIT) - set(CMAKE_REQUIRED_LIBRARIES ${libedit_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${libedit_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${LibEdit_LIBRARIES}) + set(CMAKE_REQUIRED_INCLUDES ${LibEdit_INCLUDE_DIRS}) check_symbol_exists(el_winsertstr histedit.h LLDB_EDITLINE_USE_WCHAR) set(CMAKE_EXTRA_INCLUDE_FILES histedit.h) check_type_size(el_rfunc_t LLDB_EL_RFUNC_T_SIZE) diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt index c4be006d1a11..a03fe6f4800f 100644 --- a/lldb/source/Core/CMakeLists.txt +++ b/lldb/source/Core/CMakeLists.txt @@ -99,7 +99,7 @@ add_dependencies(lldbCore set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 4) if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbCore PRIVATE ${libedit_INCLUDE_DIRS}) + target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS}) endif() if (LLDB_ENABLE_CURSES) diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index 2da0b939bd45..2e9bb4022270 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -156,14 +156,14 @@ if (HAVE_LIBDL) list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS}) endif() if (LLDB_ENABLE_LIBEDIT) - list(APPEND EXTRA_LIBS ${libedit_LIBRARIES}) + list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES}) endif() if (LLDB_ENABLE_LZMA) list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES}) endif() if (LLDB_ENABLE_LIBEDIT) - list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES}) + list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES}) if (LLVM_BUILD_STATIC) list(APPEND LLDB_SYSTEM_LIBS gpm) endif() @@ -184,5 +184,5 @@ add_lldb_library(lldbHost ) if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbHost PUBLIC ${libedit_INCLUDE_DIRS}) + target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS}) endif() diff --git a/lldb/source/Interpreter/CMakeLists.txt b/lldb/source/Interpreter/CMakeLists.txt index be9843e1101b..0ed39869467e 100644 --- a/lldb/source/Interpreter/CMakeLists.txt +++ b/lldb/source/Interpreter/CMakeLists.txt @@ -70,5 +70,5 @@ add_dependencies(lldbInterpreter LLDBInterpreterPropertiesEnumGen) if (LLDB_ENABLE_LIBEDIT) - target_include_directories(lldbInterpreter PRIVATE ${libedit_INCLUDE_DIRS}) + target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS}) endif() diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt index 9088afe81409..761772f3a371 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt +++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt @@ -4,7 +4,7 @@ endif() add_definitions(-DLLDB_PYTHON_RELATIVE_LIBDIR="${LLDB_PYTHON_RELATIVE_PATH}") if (LLDB_ENABLE_LIBEDIT) - list(APPEND LLDB_LIBEDIT_LIBS ${libedit_LIBRARIES}) + list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES}) endif() add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN @@ -28,6 +28,6 @@ add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN if (LLDB_ENABLE_LIBEDIT) target_include_directories(lldbPluginScriptInterpreterPython PUBLIC - ${libedit_INCLUDE_DIRS} + ${LibEdit_INCLUDE_DIRS} ) endif() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits