2022-04-22 14:39:00 +02:00
|
|
|
##
|
|
|
|
# @brief Includes `libvterm` (builds it if not found on the system).
|
|
|
|
#
|
|
|
|
# Provides ${LIBVTERM_LIBRARY} and implicitly adds path for correct
|
|
|
|
# `#include<>`.
|
|
|
|
#
|
|
|
|
# @warning dependency must be added like this:
|
|
|
|
# if(TARGET libvtermProject)
|
|
|
|
# add_dependencies(<targetDependingOn> libvtermProject)
|
|
|
|
# endif()
|
2022-04-13 13:10:55 +02:00
|
|
|
#
|
2022-04-22 14:39:00 +02:00
|
|
|
# @author Christian Burger <christian@krikkel.de>
|
2022-04-14 09:31:19 +02:00
|
|
|
|
2022-04-13 13:10:55 +02:00
|
|
|
|
2022-04-23 20:34:00 +02:00
|
|
|
find_library(LIBVTERM_LIBRARY NAMES "libvterm.so.0.0.2" "vterm")
|
|
|
|
find_path(LIBVTERM_INCLUDE "vterm.h")
|
2022-04-13 13:10:55 +02:00
|
|
|
|
2022-04-23 20:34:00 +02:00
|
|
|
if(NOT LIBVTERM_LIBRARY)
|
|
|
|
message(STATUS "Did not find `libvterm.so`.")
|
|
|
|
set(LIBVTERM_BUILD_IT TRUE)
|
|
|
|
endif()
|
|
|
|
if(NOT LIBVTERM_INCLUDE)
|
|
|
|
message(STATUS "Did not find `vterm.h`.")
|
|
|
|
set(LIBVTERM_BUILD_IT TRUE)
|
|
|
|
endif()
|
|
|
|
if(LIBVTERM_BUILD_IT)
|
|
|
|
include(ExternalProject)
|
|
|
|
message(STATUS "Did not find libvterm (see previous error) — building it.")
|
2022-04-13 13:10:55 +02:00
|
|
|
ExternalProject_Add(
|
|
|
|
libvtermProject
|
|
|
|
DOWNLOAD_COMMAND URL "https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/libvterm/0.1.2-2/libvterm_0.1.2.orig.tar.gz"
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_IN_SOURCE true
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
)
|
|
|
|
ExternalProject_Get_property(libvtermProject SOURCE_DIR)
|
|
|
|
set(LIBVTERM_LIBRARY "${SOURCE_DIR}/.libs/libvterm.a")
|
|
|
|
include_directories(SYSTEM "${SOURCE_DIR}/include")
|
2022-04-23 20:34:00 +02:00
|
|
|
else()
|
|
|
|
message(STATUS "Found vterm library.")
|
2022-04-13 13:10:55 +02:00
|
|
|
endif()
|