neovim/cmake/Findlibvterm.cmake
dundargoc 4c64cbe99f
build: mark uninteresting variables as advanced (#22208)
Only the most important variables should be shown by default.
2023-02-10 20:20:18 +01:00

23 lines
945 B
CMake

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 ${LIBVTERM_INCLUDE_DIR})
target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY})
mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY)