cmake: some improvements

* not depending on "-dev" packages for the built Debian package
* some refactoring in if-clauses and with "quotes"
* libvterm dependency: if something is missing, made clear what
master
Christian Burger 2022-04-23 20:34:00 +02:00
parent f994cb2261
commit ae6130f095
4 changed files with 20 additions and 10 deletions

View File

@ -58,5 +58,5 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library for a pseudo terminal where the h
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CMAKE_PROJECT_HOMEPAGE_URL})
set(CPACK_GENERATOR "DEB" "TGZ")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libncursesw6 (>=6.2), libvterm-dev (>= 0.1.2)")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libncursesw6 (>=6.2), libvterm0 (>= 0.1.2)")
include(CPack)

View File

@ -3,9 +3,9 @@
# @author Christian Burger <christian@krikkel.de>
find_path(GSL_INCLUDE_DIR "gsl/gsl" REQUIRED)
if(GSL_INCLUDE_DIR STREQUAL "GSL_INCLUDE_DIR-NOTFOUND")
if(NOT GSL_INCLUDE_DIR)
message(SEND_ERROR "Microsoft GSL not found.")
else()
message(STATUS "Microsoft GSL found.")
message(STATUS "Found Microsoft C++ GSL.")
include_directories(SYSTEM ${GSL_INCLUDE_DIR})
endif()

View File

@ -12,12 +12,20 @@
# @author Christian Burger <christian@krikkel.de>
find_library(LIBVTERM_LIBRARY NAMES libvterm.so.0.0.2 vterm)
find_library(LIBVTERM_LIBRARY NAMES "libvterm.so.0.0.2" "vterm")
find_path(LIBVTERM_INCLUDE "vterm.h")
include(ExternalProject)
if(LIBVTERM_LIBRARY STREQUAL "LIBVTERM_LIBRARY-NOTFOUND")
message(STATUS "libvterm not found — building it")
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.")
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"
@ -28,4 +36,6 @@ if(LIBVTERM_LIBRARY STREQUAL "LIBVTERM_LIBRARY-NOTFOUND")
ExternalProject_Get_property(libvtermProject SOURCE_DIR)
set(LIBVTERM_LIBRARY "${SOURCE_DIR}/.libs/libvterm.a")
include_directories(SYSTEM "${SOURCE_DIR}/include")
else()
message(STATUS "Found vterm library.")
endif()

View File

@ -8,8 +8,8 @@ find_package(Curses 6.2 REQUIRED)
include_directories(SYSTEM ${CURSES_INCLUDE_DIRS})
# find C++ interface for ncurses with unicode support
find_library(CURSES_CPP_WIDE_LIBRARY NAMES ncurses++w REQUIRED)
find_library(CURSES_CPP_WIDE_LIBRARY NAMES ncurses++w)
if(NOT CURSES_CPP_WIDE_LIBRARY)
message(FATAL_ERROR "C++ interface for ncurses (wide/unicode) not found.")
message(SEND_ERROR "C++ interface for ncurses (wide/unicode) not found.")
endif()
list(APPEND CURSES_LIBRARIES ${CURSES_CPP_WIDE_LIBRARY})