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.
This commit is contained in:
parent
ef07c3ac06
commit
8e71512f12
|
@ -1,3 +1,5 @@
|
||||||
|
# @author Christian Burger <christian@krikkel.de>
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16.3)
|
cmake_minimum_required(VERSION 3.16.3)
|
||||||
project(NCursesPtyWindow VERSION 0.1.0)
|
project(NCursesPtyWindow VERSION 0.1.0)
|
||||||
|
|
||||||
|
@ -6,15 +8,17 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
include("cmake/ncurses.cmake")
|
include("cmake/ncurses.cmake")
|
||||||
include("cmake/gsl.cmake")
|
include("cmake/gsl.cmake")
|
||||||
|
|
||||||
|
add_library(NCursesPtyWindow NCursesPtyWindow.cpp SingleUserInput.cpp Debug.cpp)
|
||||||
|
|
||||||
### libraries
|
### libraries
|
||||||
find_library(LIBVTERM_LIBRARY vterm)
|
|
||||||
|
include("cmake/libvterm.cmake")
|
||||||
find_library(UTIL_LIBRARY util)
|
find_library(UTIL_LIBRARY util)
|
||||||
|
|
||||||
add_library(NCursesPtyWindow NCursesPtyWindow.cpp SingleUserInput.cpp Debug.cpp)
|
|
||||||
target_link_libraries(NCursesPtyWindow ${CURSES_LIBRARIES} ${LIBVTERM_LIBRARY} ${UTIL_LIBRARY})
|
target_link_libraries(NCursesPtyWindow ${CURSES_LIBRARIES} ${LIBVTERM_LIBRARY} ${UTIL_LIBRARY})
|
||||||
|
|
||||||
### threads
|
### threads
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# @author Christian Burger <christian@krikkel.de>
|
||||||
|
|
||||||
find_path(GSL_INCLUDE_DIR "gsl")
|
find_path(GSL_INCLUDE_DIR "gsl")
|
||||||
if(GSL_INCLUDE_DIR STREQUAL "GSL_INCLUDE_DIR-NOTFOUND")
|
if(GSL_INCLUDE_DIR STREQUAL "GSL_INCLUDE_DIR-NOTFOUND")
|
||||||
message(SEND_ERROR "Microsoft GSL not found.")
|
message(SEND_ERROR "Microsoft GSL not found.")
|
||||||
|
|
21
cmake/libvterm.cmake
Normal file
21
cmake/libvterm.cmake
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# @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()
|
|
@ -1,3 +1,5 @@
|
||||||
|
# @author Christian Burger <christian@krikkel.de>
|
||||||
|
|
||||||
### ncurses
|
### ncurses
|
||||||
set(CURSES_NEED_NCURSES TRUE)
|
set(CURSES_NEED_NCURSES TRUE)
|
||||||
set(CURSES_NEED_WIDE TRUE)
|
set(CURSES_NEED_WIDE TRUE)
|
||||||
|
|
Loading…
Reference in a new issue