From 417f9fcbf2c49d811f1ea0f3a0e3b5d88dece533 Mon Sep 17 00:00:00 2001 From: osamu-kj <64986162+0xdeadbeer@users.noreply.github.com> Date: Sun, 14 May 2023 14:22:27 +0200 Subject: [PATCH] CMake: Add necessary install rules for 'make install' --- CMakeLists.txt | 6 +++++- src/CMakeLists.txt | 3 +++ src/base64/CMakeLists.txt | 1 + src/calendar/CMakeLists.txt | 1 + src/engine/CMakeLists.txt | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a7d60e..e18d95c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,10 +19,14 @@ project(vis VERSION 1.0 DESCRIPTION "Vi Scheduler (vis) is a simple TUI program built for managing your schedules in a calendar-like grid." LANGUAGES CXX C) + -set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) add_subdirectory(src) find_library(NCURSES_LIB NAMES ncurses) target_link_libraries(vis ncurses) +install(TARGETS vis DESTINATION bin) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a63dd98..b3ca67f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,3 +7,6 @@ add_executable(vis main.cpp) target_link_libraries(vis engine) target_link_libraries(vis calendar) target_link_libraries(vis base64) + +set(installable_libs engine calendar base64) +install(TARGETS ${installable_libs} DESTINATION lib) diff --git a/src/base64/CMakeLists.txt b/src/base64/CMakeLists.txt index dc22ad0..833cf01 100644 --- a/src/base64/CMakeLists.txt +++ b/src/base64/CMakeLists.txt @@ -1 +1,2 @@ add_library(base64 SHARED base64.c) +install(FILES base64.h DESTINATION include) diff --git a/src/calendar/CMakeLists.txt b/src/calendar/CMakeLists.txt index 19b6b07..e0f0782 100644 --- a/src/calendar/CMakeLists.txt +++ b/src/calendar/CMakeLists.txt @@ -1 +1,2 @@ add_library(calendar SHARED calendar.cpp) +install(FILES calendar.hpp DESTINATION include) diff --git a/src/engine/CMakeLists.txt b/src/engine/CMakeLists.txt index cde64e3..980b221 100644 --- a/src/engine/CMakeLists.txt +++ b/src/engine/CMakeLists.txt @@ -1 +1,2 @@ add_library(engine SHARED engine.cpp) +install(FILES engine.hpp DESTINATION include)