From 6e906c1de7bc5442ca2232d851e20bfc2c02ed98 Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Fri, 19 Nov 2021 18:52:03 -0800
Subject: [PATCH 1/3] cmake: add install target

This adds a simple install target to install the compiled binary + dbus
conf file.

The intention is to simplify distro packaging, building/installing will
be similar to most other projects that use cmake.
---
 CMakeLists.txt     | 11 +++++++++++
 src/CMakeLists.txt | 11 ++---------
 2 files changed, 13 insertions(+), 9 deletions(-)
 create mode 100644 CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..245bb10
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.5)
+project(waked LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(sdbus-c++ REQUIRED)
+
+add_subdirectory(src)
+
+install(FILES de.seath.Waked.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/etc/dbus-1/system.d/")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a24e527..a89508d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,12 +1,5 @@
-cmake_minimum_required(VERSION 3.5)
-
-project(waked LANGUAGES CXX)
-
-set(CMAKE_CXX_STANDARD 17)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-find_package(sdbus-c++ REQUIRED)
-
 add_executable(waked main.cpp alarm.cpp)
 
 target_link_libraries(waked PRIVATE SDBusCpp::sdbus-c++)
+
+install(TARGETS waked DESTINATION "${CMAKE_INSTALL_BINDIR}")
-- 
2.41.0

