From 7af4c57fa4841377d723799c55e4d35226dffd00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= <jbb@kaidan.im>
Date: Wed, 17 Jul 2024 20:39:14 +0200
Subject: [PATCH] Fix compilation error due to duplicated definitions

---
 daemon/CMakeLists.txt                     | 2 --
 lib/CMakeLists.txt                        | 1 +
 lib/config/CMakeLists.txt                 | 8 ++++++++
 {src => lib/config}/settingsmanager.kcfg  | 0
 {src => lib/config}/settingsmanager.kcfgc | 0
 lib/mms/CMakeLists.txt                    | 3 +--
 src/CMakeLists.txt                        | 3 +--
 7 files changed, 11 insertions(+), 6 deletions(-)
 create mode 100644 lib/config/CMakeLists.txt
 rename {src => lib/config}/settingsmanager.kcfg (100%)
 rename {src => lib/config}/settingsmanager.kcfgc (100%)

diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
index 36f70b18..fc805c44 100644
--- a/daemon/CMakeLists.txt
+++ b/daemon/CMakeLists.txt
@@ -19,8 +19,6 @@ qt_add_dbus_adaptor(spacebar_daemon_SRCS
 
 add_executable(spacebar-daemon ${spacebar_daemon_SRCS})
 
-kconfig_add_kcfg_files(spacebar-daemon ../src/settingsmanager.kcfgc GENERATE_MOC)
-
 target_compile_definitions(spacebar-daemon PRIVATE -DQT_NO_CAST_FROM_ASCII)
 target_link_libraries(spacebar-daemon PRIVATE
     Qt6::Concurrent
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index fda71f96..455307c9 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -4,3 +4,4 @@ target_include_directories(macros PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
 add_subdirectory(telephonySupport)
 add_subdirectory(database)
 add_subdirectory(mms)
+add_subdirectory(config)
diff --git a/lib/config/CMakeLists.txt b/lib/config/CMakeLists.txt
new file mode 100644
index 00000000..da453acd
--- /dev/null
+++ b/lib/config/CMakeLists.txt
@@ -0,0 +1,8 @@
+# SPDX-FileCopyrightText: 2024 Jonah Brüchert <jbb@kaidan.im>
+# SPDX-License-Identifier: BSD-2-Clause
+
+add_library(config STATIC)
+
+kconfig_add_kcfg_files(config settingsmanager.kcfgc GENERATE_MOC)
+
+target_link_libraries(config PUBLIC Qt6::Core KF6::ConfigGui KF6::ConfigCore)
diff --git a/src/settingsmanager.kcfg b/lib/config/settingsmanager.kcfg
similarity index 100%
rename from src/settingsmanager.kcfg
rename to lib/config/settingsmanager.kcfg
diff --git a/src/settingsmanager.kcfgc b/lib/config/settingsmanager.kcfgc
similarity index 100%
rename from src/settingsmanager.kcfgc
rename to lib/config/settingsmanager.kcfgc
diff --git a/lib/mms/CMakeLists.txt b/lib/mms/CMakeLists.txt
index ce09f853..3b70791d 100644
--- a/lib/mms/CMakeLists.txt
+++ b/lib/mms/CMakeLists.txt
@@ -2,8 +2,7 @@
 # SPDX-License-Identifier: BSD-2-Clause
 
 add_library(mms STATIC mms.cpp)
-kconfig_add_kcfg_files(mms ../../src/settingsmanager.kcfgc GENERATE_MOC)
 target_compile_definitions(mms PRIVATE -DQT_NO_CAST_FROM_ASCII)
-target_link_libraries(mms PUBLIC Qt6::Core KF6::ConfigGui macros kTelephonySupport)
+target_link_libraries(mms PUBLIC Qt6::Core KF6::ConfigGui macros kTelephonySupport config)
 
 target_include_directories(mms PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79c1b1dc..0520db69 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -14,8 +14,6 @@ qt_add_resources(RESOURCES resources.qrc)
 
 add_executable(spacebar ${spacebar_SRCS} ${RESOURCES})
 
-kconfig_add_kcfg_files(spacebar settingsmanager.kcfgc GENERATE_MOC)
-
 add_dependencies(spacebar spacebar-daemon)
 
 target_include_directories(spacebar PRIVATE ${CMAKE_BINARY_DIR})
@@ -41,6 +39,7 @@ target_link_libraries(spacebar PRIVATE
     database
     kTelephonySupport
     macros
+    config
     QCoro::Core
     QCoro::DBus
 )
-- 
GitLab

