kNCurses/CMakeLists.txt

83 lines
3.1 KiB
CMake

##
# @author Christian Burger <christian@krikkel.de>
cmake_minimum_required(VERSION 3.16.3)
include("cmake/version.cmake")
project(kNCurses
HOMEPAGE_URL "https://gitea.xndr.de/christian/kNCurses"
VERSION ${SEMANTIC_VERSION})
set(CMAKE_CXX_STANDARD 17)
include(CTest)
enable_testing()
add_library(kNCurses src/krikkel/NCurses/Window.cpp
src/krikkel/NCurses/PtyWindow.cpp
src/krikkel/NCurses/SingleUserInput.cpp
src/krikkel/NCurses/TilingWindowManager.cpp
src/krikkel/NCurses/VerticalTilingWindowManager.cpp
src/krikkel/NCurses/HorizontalTilingWindowManager.cpp
src/krikkel/Debug.cpp
)
### let's be annoyingly pedantic
target_compile_options(kNCurses PRIVATE "-Wall" "-Wextra" "-Werror" "-pedantic")
### path to own includes
include_directories("${CMAKE_SOURCE_DIR}/include")
### libraries
include("cmake/ncurses.cmake")
target_link_libraries(kNCurses ${CURSES_LIBRARIES})
include("cmake/gsl.cmake")
include("cmake/libvterm.cmake")
if(EXISTS libvtermProject)
add_dependencies(kNCurses libvtermProject)
endif()
target_link_libraries(kNCurses ${LIBVTERM_LIBRARY})
find_library(UTIL_LIBRARY util)
target_link_libraries(kNCurses ${UTIL_LIBRARY})
set(THREADS_PREFER_PTHREAD_FLAG true)
find_package(Threads REQUIRED)
target_link_libraries(kNCurses Threads::Threads)
### demo application
add_executable(kNCursesDemoApp src/krikkel/NCurses/main.cpp
src/krikkel/NCurses/DemoApp.cpp)
target_compile_options(kNCursesDemoApp PRIVATE "-Wall" "-Wextra" "-Werror" "-pedantic")
target_link_libraries(kNCursesDemoApp kNCurses)
### installation and packaging
set(KNCURSES_SYSTEM_INCLUDE "include/kNCurses")
string(CONCAT KNCURSES_PUBLIC_HEADERS "${KNCURSES_SYSTEM_INCLUDE}/Window.hpp;"
"${KNCURSES_SYSTEM_INCLUDE}/SingleUserInput.hpp;"
"${KNCURSES_SYSTEM_INCLUDE}/PtyWindow.hpp;"
"${KNCURSES_SYSTEM_INCLUDE}/TilingWindowManager.hpp;"
"${KNCURSES_SYSTEM_INCLUDE}/VerticalTilingWindowManager.hpp;"
"${KNCURSES_SYSTEM_INCLUDE}/HorizontalTilingWindowManager.hpp;"
)
set_target_properties(kNCurses PROPERTIES
PUBLIC_HEADER "${KNCURSES_PUBLIC_HEADERS}"
VERSION "${CMAKE_PROJECT_VERSION}")
include(GNUInstallDirs)
install(TARGETS kNCurses kNCursesDemoApp ARCHIVE
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kNCurses/")
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_CONTACT "Christian Burger <christian@krikkel.de>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library for a pseudo terminal where the host end is a ncurses window")
# 3.16.3 does not pick up the project's homepage URL by itself
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CMAKE_PROJECT_HOMEPAGE_URL})
set(CPACK_GENERATOR "DEB" "TGZ")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libncursesw6 (>=6.2), libvterm0 (>= 0.1.2)")
include(CPack)