mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
Ensure bundled libraries and include directories are always searched first before any others. This will provide a more consistent experience as the search order of the builtin find_ functions can vary depending on system. This should make the build process faster when building with bundled deps as we limit the search to only the .deps directory. Separating the search between .deps and everything makes debugging find_-related problems simpler if you need to check how dependencies are found. For libraries, we divide the search process into the following order: 1. Only search in .deps directory and only search for static libraries. 2. Only search in .deps directory and search for all libraries. 3. Search everywhere and search for all libraries. Make an exception for FindLibintl.cmake as changing the search order seems to break some tests on macos.
23 lines
947 B
CMake
23 lines
947 B
CMake
find_path2(LIBVTERM_INCLUDE_DIR vterm.h)
|
|
find_library2(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)
|