aboutsummaryrefslogtreecommitdiff
path: root/cmake/FindLibvterm.cmake
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-03-02 22:50:43 +0100
committerGitHub <noreply@github.com>2023-03-02 22:50:43 +0100
commit4cf4ae93df6af09ef3a0df678bb3d154b65bf731 (patch)
treee9b47e7b94fe74f1f568cfbca89790716a1c0625 /cmake/FindLibvterm.cmake
parentf449121764c19cebda7b8b2c970b76bc8121bae7 (diff)
downloadrneovim-4cf4ae93df6af09ef3a0df678bb3d154b65bf731.tar.gz
rneovim-4cf4ae93df6af09ef3a0df678bb3d154b65bf731.tar.bz2
rneovim-4cf4ae93df6af09ef3a0df678bb3d154b65bf731.zip
build: cmake cleanup (#22251)
- Remove unused code - Use consistent casing. Variable names such as LibLuV_LIBRARIES is needlessly jarring, even if the name might be technically correct. - Use title casing for packages. find_package(unibilium) requires the find_module to be named "Findunibilium.cmake", which makes it harder to spot when scanning the files. Instead, use "Unibilium".
Diffstat (limited to 'cmake/FindLibvterm.cmake')
-rw-r--r--cmake/FindLibvterm.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake
new file mode 100644
index 0000000000..ad2e682b30
--- /dev/null
+++ b/cmake/FindLibvterm.cmake
@@ -0,0 +1,22 @@
+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)