kNCurses/cmake/libvterm.cmake
Christian Burger 8e71512f12 cmake: locate or build libvterm dependency
There is no version detection. If there is any vterm library, it is
used. If it is the wrong version, there will be an build error.
`libvterm.so.0.0.2` is preferred, which hopefully is compatible to
revision 740 or Ubuntu `libvterm0` version 0.1.2-2.

If no library is found, the correct one is downloaded and build.
2022-04-13 13:10:55 +02:00

22 lines
863 B
CMake

# @author Christian Burger <christian@krikkel.de>
# @brief searches for libvterm and builds it if not found
#
# requires NCursesPtyWindow target; provides LIBVTERM_LIBRARY
find_library(LIBVTERM_LIBRARY NAMES libvterm.so.0.0.2 vterm)
if(LIBVTERM_LIBRARY STREQUAL "LIBVTERM_LIBRARY-NOTFOUND")
message(STATUS "libvterm not found — building it")
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")
add_dependencies(NCursesPtyWindow libvtermProject)
endif()