Skip to content

Commit cf24bec

Browse files
committed
fix: Respect CMAKE_INSTALL_LIBDIR for module installation and lookup
This ensures correct installation and runtime lookup on both lib and lib64 based systems. Log: - Define CMAKE_INSTALL_FULL_LIBDIR in top-level CMakeLists.txt - Replace hardcoded 'lib/dde-session-shell/modules' with '${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules' in all plugin CMakeLists - Update modules_loader.cpp to use CMAKE_INSTALL_FULL_LIBDIR for locating modules and configs
1 parent 08ac95d commit cf24bec

File tree

11 files changed

+17
-11
lines changed

11 files changed

+17
-11
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
cmake_minimum_required(VERSION 3.16)
22
project(dde-session-shell C CXX)
33

4+
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
5+
set(CMAKE_INSTALL_LIBDIR lib)
6+
endif()
7+
48
include(GNUInstallDirs)
59
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
610
set(CMAKE_INSTALL_PREFIX /usr)
711
endif ()
812

13+
add_definitions(-DCMAKE_INSTALL_FULL_LIBDIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")
14+
915
set(CMAKE_CXX_STANDARD 17)
1016
set(CMAKE_INCLUDE_CURRENT_DIR ON)
1117
set(CMAKE_AUTOMOC ON)

plugins/assist_login/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ aux_source_directory(. SRCS)
2020
add_library(${LIB_NAME} SHARED ${SRCS})
2121

2222
add_subdirectory(interface)
23-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
23+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/assist_login/interface/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ link_libraries(
2828

2929
# 安装/user/lib
3030
install(FILES include/assist_login_interface.h DESTINATION /usr/include/dde-session-shell)
31-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
31+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/examples/login-plugins/login-basic/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,4 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE
8181
set(CMAKE_INSTALL_PREFIX "/usr")
8282

8383
# 设置执行 make install 时哪个目标应该被 install 到哪个位置
84-
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
84+
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/examples/login-plugins/login-complex/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ aux_source_directory(. SRCS)
1212

1313
add_library(${LIB_NAME} SHARED ${SRCS})
1414

15-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
15+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/examples/login-plugins/login-fullManaged/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ aux_source_directory(. SRCS)
1212

1313
add_library(${LIB_NAME} SHARED ${SRCS})
1414

15-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
15+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/examples/login-plugins/login-udcp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ aux_source_directory(. SRCS)
1212

1313
add_library(${LIB_NAME} SHARED ${SRCS} login-plugin.qrc)
1414

15-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
15+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/examples/tray-plugins/network/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ aux_source_directory(. SRCS)
1212

1313
add_library(${LIB_NAME} SHARED ${SRCS})
1414

15-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
15+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/examples/tray-plugins/webview/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ target_link_libraries(${LIB_NAME} PRIVATE
2323
Qt${QT_VERSION_MAJOR}::WebEngineWidgets
2424
)
2525

26-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
26+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

plugins/one-key-login/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ aux_source_directory(. SRCS)
1212

1313
add_library(${LIB_NAME} SHARED ${SRCS})
1414

15-
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules)
15+
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules)

0 commit comments

Comments
 (0)