From 18e6891a56f471168cbe964c61c134f6d2aeb90d Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
Date: Fri, 15 Dec 2023 21:06:06 +0800
Subject: [PATCH] fix(plugins): Fix runtime plugin loading errors
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- 修复运行时插件加载错误，补全相关依赖
---
 CMakeLists.txt                 |  2 +-
 common/plugin-subitem.h        |  4 ++--
 plugins/account/CMakeLists.txt | 12 +++++++++---
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fe9765..07a668d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,4 +102,4 @@ add_subdirectory(lib)
 add_subdirectory(libexec)
 add_subdirectory(launcher)
 add_subdirectory(plugins)
-add_subdirectory(data)
\ No newline at end of file
+add_subdirectory(data)
diff --git a/common/plugin-subitem.h b/common/plugin-subitem.h
index f6f6287..1315fda 100644
--- a/common/plugin-subitem.h
+++ b/common/plugin-subitem.h
@@ -32,7 +32,7 @@ public:
           m_pCreateWidget(func)
     {
     }
-    ~PluginSubItem();
+    ~PluginSubItem(){};
 
 public:
     // 功能项ID,用于区分功能项,应确保其唯一
@@ -72,4 +72,4 @@ private:
     QString m_icon;
     int m_weight;
     CreateWidgetFunc m_pCreateWidget = nullptr;
-};
\ No newline at end of file
+};
diff --git a/plugins/account/CMakeLists.txt b/plugins/account/CMakeLists.txt
index 98c5383..586c6c8 100644
--- a/plugins/account/CMakeLists.txt
+++ b/plugins/account/CMakeLists.txt
@@ -5,6 +5,8 @@ if (PASSWD_EXPIRATION_POLICY_VISIBLE)
 endif ()
 
 pkg_search_module(CRYPTOPP REQUIRED cryptopp)
+pkg_search_module(PAM REQUIRED pam)
+pkg_search_module(LIBCRYPT REQUIRED libcrypt)
 
 file(GLOB_RECURSE ACCOUNT_SRC
         ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
@@ -22,11 +24,13 @@ target_include_directories(${TARGET_NAME} PRIVATE
         ${CMAKE_BINARY_DIR}
         ${CMAKE_CURRENT_SOURCE_DIR}/pages
         ${CMAKE_CURRENT_SOURCE_DIR}/utils
+	${PAM_INCLUDE_DIRS}
         ${KIRAN_WIDGETS_INCLUDE_DIRS}
         ${KIRAN_CC_DAEMON_INCLUDE_DIRS}
         ${KLOG_INCLUDE_DIRS}
         ${KIRAN_STYLE_INCLUDE_DIRS}
-        ${CRYPTOPP_INCLUDE_DIRS})
+        ${CRYPTOPP_INCLUDE_DIRS}
+	${LIBCRYPT_INCLUDE_DIRS})
 
 target_link_libraries(${TARGET_NAME}
         common-widgets
@@ -34,10 +38,12 @@ target_link_libraries(${TARGET_NAME}
         Qt5::Widgets
         Qt5::DBus
         Qt5::Svg
+	${PAM_LIBRARIES}
         ${KIRAN_WIDGETS_LIBRARIES}
         ${KIRAN_CC_DAEMON_LIBRARIES}
         ${KLOG_LIBRARIES}
         ${KIRAN_STYLE_LIBRARIES}
-        ${CRYPTOPP_LIBRARIES})
+        ${CRYPTOPP_LIBRARIES}
+	${LIBCRYPT_LIBRARIES})
 
-install(TARGETS ${TARGET_NAME} DESTINATION ${PLUGIN_LIBS_DIR}/)
\ No newline at end of file
+install(TARGETS ${TARGET_NAME} DESTINATION ${PLUGIN_LIBS_DIR}/)
-- 
2.27.0

