FindLibVterm.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # - Try to find libvterm
  2. # Once done this will define
  3. # LIBVTERM_FOUND - System has libvterm
  4. # LIBVTERM_INCLUDE_DIRS - The libvterm include directories
  5. # LIBVTERM_LIBRARIES - The libraries needed to use libvterm
  6. if(NOT USE_BUNDLED_LIBVTERM)
  7. find_package(PkgConfig)
  8. if (PKG_CONFIG_FOUND)
  9. pkg_check_modules(PC_LIBVTERM QUIET vterm)
  10. endif()
  11. else()
  12. set(PC_LIBVTERM_INCLUDEDIR)
  13. set(PC_LIBVTERM_INCLUDE_DIRS)
  14. set(PC_LIBVTERM_LIBDIR)
  15. set(PC_LIBVTERM_LIBRARY_DIRS)
  16. set(LIMIT_SEARCH NO_DEFAULT_PATH)
  17. endif()
  18. set(LIBVTERM_DEFINITIONS ${PC_LIBVTERM_CFLAGS_OTHER})
  19. find_path(LIBVTERM_INCLUDE_DIR vterm.h
  20. PATHS ${PC_LIBVTERM_INCLUDEDIR} ${PC_LIBVTERM_INCLUDE_DIRS}
  21. ${LIMIT_SEARCH})
  22. # If we're asked to use static linkage, add libuv.a as a preferred library name.
  23. if(LIBVTERM_USE_STATIC)
  24. list(APPEND LIBVTERM_NAMES
  25. "${CMAKE_STATIC_LIBRARY_PREFIX}vterm${CMAKE_STATIC_LIBRARY_SUFFIX}")
  26. endif()
  27. list(APPEND LIBVTERM_NAMES vterm)
  28. find_library(LIBVTERM_LIBRARY NAMES ${LIBVTERM_NAMES}
  29. HINTS ${PC_LIBVTERM_LIBDIR} ${PC_LIBVTERM_LIBRARY_DIRS}
  30. ${LIMIT_SEARCH})
  31. set(LIBVTERM_LIBRARIES ${LIBVTERM_LIBRARY})
  32. set(LIBVTERM_INCLUDE_DIRS ${LIBVTERM_INCLUDE_DIR})
  33. include(FindPackageHandleStandardArgs)
  34. # handle the QUIETLY and REQUIRED arguments and set LIBVTERM_FOUND to TRUE
  35. # if all listed variables are TRUE
  36. find_package_handle_standard_args(LibVterm DEFAULT_MSG
  37. LIBVTERM_LIBRARY LIBVTERM_INCLUDE_DIR)
  38. mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY)