neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 843c9025ae8b44b14d0908674c8874a51dc13a38
parent 3c2bb1b2bec993cbcd6d65572c531aafbefa25a1
Author: dundargoc <33953936+dundargoc@users.noreply.github.com>
Date:   Thu, 26 Jan 2023 21:35:06 +0100

build: check if libvterm version meets requirement (#22010)

The vterm.h file only specifies major and minor version, but not patch,
meaning that requiring a specific patch number isn't currently possible.
Diffstat:
Dcmake/FindLIBVTERM.cmake | 10----------
Acmake/Findlibvterm.cmake | 20++++++++++++++++++++
Msrc/nvim/CMakeLists.txt | 5++---
3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/cmake/FindLIBVTERM.cmake b/cmake/FindLIBVTERM.cmake @@ -1,10 +0,0 @@ -# - Try to find libvterm -# Once done this will define -# LIBVTERM_FOUND - System has libvterm -# LIBVTERM_INCLUDE_DIRS - The libvterm include directories -# LIBVTERM_LIBRARIES - The libraries needed to use libvterm - -include(LibFindMacros) - -libfind_pkg_detect(LIBVTERM vterm FIND_PATH vterm.h FIND_LIBRARY vterm) -libfind_process(LIBVTERM REQUIRED) diff --git a/cmake/Findlibvterm.cmake b/cmake/Findlibvterm.cmake @@ -0,0 +1,20 @@ +find_path(LIBVTERM_INCLUDE_DIR vterm.h) +find_library(LIBVTERM_LIBRARY vterm) + +if(LIBVTERM_INCLUDE_DIR AND EXISTS "${LIBVTERM_INCLUDE_DIR}/vterm.h") + file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MAJOR REGEX "#define VTERM_VERSION_MAJOR") + string(REGEX MATCH "[0-9]+" VTERM_VERSION_MAJOR ${VTERM_VERSION_MAJOR}) + + file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MINOR REGEX "#define VTERM_VERSION_MINOR") + string(REGEX MATCH "[0-9]+" VTERM_VERSION_MINOR ${VTERM_VERSION_MINOR}) + + set(VTERM_VERSION ${VTERM_VERSION_MAJOR}.${VTERM_VERSION_MINOR}) +endif() + +find_package_handle_standard_args(libvterm + REQUIRED_VARS LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY + VERSION_VAR VTERM_VERSION) + +add_library(libvterm INTERFACE) +target_include_directories(libvterm SYSTEM BEFORE INTERFACE INTERFACE ${LIBVTERM_INCLUDE_DIR}) +target_link_libraries(main_lib INTERFACE ${LIBVTERM_LIBRARY}) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt @@ -30,9 +30,8 @@ find_package(LibTermkey 0.22 REQUIRED) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LIBTERMKEY_INCLUDE_DIRS}) target_link_libraries(main_lib INTERFACE ${LIBTERMKEY_LIBRARIES}) -find_package(LIBVTERM 0.3 REQUIRED) -target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIRS}) -target_link_libraries(main_lib INTERFACE ${LIBVTERM_LIBRARIES}) +find_package(libvterm 0.3 REQUIRED) +target_link_libraries(main_lib INTERFACE libvterm) find_package(Iconv REQUIRED) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${Iconv_INCLUDE_DIRS})